density unit output

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
angi_sfj
Posts: 15
Joined: 2019-04-18T03:08:17-07:00
Authentication code: 1152

density unit output

Post by angi_sfj »

hi, i'm try to archive converting a bitmap to jpg cmyk ppi.
i set

Code: Select all

           using (MagickImage image = new MagickImage(bmp))
            {
              image.ColorAlpha(new MagickColor("#FFF")); // You only need this when your image contains transparency.
              image.Settings.Density = new Density(nBmpPrm.dpi, nBmpPrm.dpi, DensityUnit.PixelsPerInch);
              image.AddProfile(ColorProfile.SRGB);
              image.AddProfile(ColorProfile.CoatedFOGRA39);     // USWebCoatedSWOP
              image.Write(fullPath);
            }
but in gimp now i see

Code: Select all

JPEG image
5,9 × 5,9 pixels/mm
sRGB built-in Default RGB working space
what's wrong?

thankyou
angi_sfj
Posts: 15
Joined: 2019-04-18T03:08:17-07:00
Authentication code: 1152

Re: density unit output

Post by angi_sfj »

the same if i remove
image.AddProfile(ColorProfile.SRGB);
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: density unit output

Post by snibgo »

What is wrong with your result?

I guess your nBmpPrm.dpi was 150, and 150 dots per inch is 5.9 dots per millimetre.
snibgo's IM pages: im.snibgo.com
angi_sfj
Posts: 15
Joined: 2019-04-18T03:08:17-07:00
Authentication code: 1152

Re: density unit output

Post by angi_sfj »

thanks for your reply.

color space results sRGB, not cmyk

and i'd archive resolution units pixels/mm, as if i open other random image that says 150 × 150 ppi.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: density unit output

Post by snibgo »

Gimp can't process CMYK images, so those are converted to sRGB when they are read. To find the colorspace of the jpg file, I suggest you use exiftool.
snibgo's IM pages: im.snibgo.com
angi_sfj
Posts: 15
Joined: 2019-04-18T03:08:17-07:00
Authentication code: 1152

Re: density unit output

Post by angi_sfj »

grat thank you.
for color space it's ok.
but still here the file worked with

Code: Select all

DensityUnit.PixelsPerInch
results in a Resolution Unit : cm.
is it possibile to make it sign as Resolution Unit : inches as the original image is?
thankyou
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: density unit output

Post by 246246 »

You said original image is bitmap. So as for a spec, its original unit is pixels per meter.
https://en.wikipedia.org/wiki/BMP_file_format
angi_sfj
Posts: 15
Joined: 2019-04-18T03:08:17-07:00
Authentication code: 1152

Re: density unit output

Post by angi_sfj »

you're right, i make a shortcut in description.
My original image is jpg.
in my program to elaborate it I create a bitmap .net object.
if i save it with .net framework methods i get resolution in ppi
if i save it with imagemagick i get resolution in ppcm.

is it possibile to have an output jpg signed with Resolution Unit : inches ?

thank you
Post Reply