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 » 2019-04-18T03:11:10-07:00

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 » 2019-04-18T03:11:39-07:00

the same if i remove
image.AddProfile(ColorProfile.SRGB);

snibgo
Posts: 12034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: density unit output

Post by snibgo » 2019-04-18T04:49:56-07:00

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 » 2019-04-18T07:48:25-07:00

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: 12034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: density unit output

Post by snibgo » 2019-04-18T08:08:37-07:00

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 » 2019-04-18T08:57:40-07:00

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 » 2019-04-28T06:41:28-07:00

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 » 2019-04-28T14:23:44-07:00

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