PSD to PNG conversion color does not match - imagemagick

convert sample.psd[0] out.png
Sample PSD file : [https://www.dropbox.com/s/0zbae636mkkeikd/12788_109282907_1.psd?dl=0]

You need to use profiles to convert from CMYK to sRGB, since PNG does not support CMYK. You can use profiles in Imagemagick as follows. But you will need to use your own paths to profiles and perhaps download them.
convert 12788_109282907_1.psd[0] -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc 12788_109282907_1.png
You can get some profiles from Imagemagick at https://imagemagick.org/archive/delegates/

Related

ImageMagick problem with identify of DNG Image without extension

I'm trying to get format, filesize, width and height from an DNG Image. With a .DNG extension identify L1004220.dng returns the correct data: L1004220.DNG DNG 5216x3472 5216x3472+0+0 16-bit sRGB 17.4867MiB 0.000u 0:00.003.
The problem now is, I've made a md5 hash from the filename and stored it somewhere else, lets call the file 17a14024496c3bea3b81362510962785. Now if I run the same command with the md5 filename it will give me another result: 17a14024496c3bea3b81362510962785 TIFF 320x216 320x216+0+0 8-bit sRGB 17.4867MiB 0.010u 0:00.008
It somehow identified it as a TIFF instead of a DNG image.
But when I give 17a14024496c3bea3b81362510962785 a .dng extension, it again works.
I only have this problem with DNG images. Other formats work as expected.
I run it on Linux. I installed the libraw-dev package which ImageMagick uses as a delegate for DNG Images. I use a self compiled ImageMagick 7.
For testing I used a sample image (Original DNG (18MB)) from here https://www.kenrockwell.com/leica/m9/sample-photos-3.htm
Anyone encountered this problem before? Am I using the wrong package as delegate?
I was able to solve the problem by adding dng: before the filename like:
identify dng:17a14024496c3bea3b81362510962785
result:
dng:17a14024496c3bea3b81362510962785=>17a14024496c3bea3b81362510962785 DNG 5216x3472 5216x3472+0+0 16-bit sRGB 17.4867MiB 0.010u 0:00.003

Convert pdf to image with imagemagick and get the list of outputted files

I found how to convert my pdf into png files with the convert command. It is great because out of the box it creates an image for each pages in the pdf which is exacly what I need. The thing is I don't know in advance how many pages my pdf has, so I don't know how many pages convert has created. I looked and looked on the Internet and read the imagemagick site but could not find an appropriate way to output the information I need.
I need a very simple output, something like this:
$ convert in.pdf out.png
out-0.png
out-1.png
out-2.png
...
In ImageMagick, just do:
identify in.pdf
in.pdf[0] PDF 256x256 256x256+0+0 16-bit sRGB 139350B 0.000u 0:00.002
in.pdf[1] PDF 256x256 256x256+0+0 16-bit sRGB 139350B 0.010u 0:00.001
in.pdf[2] PDF 256x256 256x256+0+0 16-bit sRGB 139350B 0.010u 0:00.000
or if you only want the names, then
identify -format "%f[%p]\n" in.pdf
in.pdf[0]
in.pdf[1]
in.pdf[2]
or if you just want to know the number of pages:
identify -format "%n\n" in.pdf | head -n 1
3
Note without the pipe to head, you will get 3 repeated 3 times
See
https://imagemagick.org/script/identify.php
https://imagemagick.org/script/escape.php

How do I convert a CMYK tif with unknown profile to png (RBG)?

I am trying to convert a tiff CMYK image to PNG and cannot find out the ICC profile, which leads to wrong colors in the converted PNG.
I tried the following to determine the profile:
$ identify -format "%[profile:icc]" test.tif
With no result.
And, the following, with no usable result:
$ identify -verbose test.tiff |grep -i profile
crs:CameraProfile: Adobe Standard
crs:CameraProfileDigest: 3DA8CE4A626CE36A1D0C55BF157793C9
crs:LensProfileEnable: 0
crs:LensProfileSetup: LensDefaults
Profiles:
Profile-8bim: 8730 bytes
Profile-tiff:37724: 3132408 bytes
Profile-xmp: 30533 bytes
After that I downloaded Adobe's profiles and tried each of them, but not a single one did work. This is how I tried to apply the profiles:
convert -profile CMYKProfiles.icc -profile AppleRGB.icc -colorspace rgb test.tif test.png
That works, but only if I know the profile and supply the right profile. In my case that doesn't work.
Is the image just broken or is there a way to convert it preserving its colors?
Your file has 4 layers or pages. The one you want seems to be the first layer/page. Each is CMYK with no color profile. Without profiles, it is possible that each display device might show the image differently depending upon what default profile is used, if any.
But with Imagemagick, I get pretty close using USWebCoatedSwop.icc and sRGB.icc profiles as follows
convert -quiet test.tif[0] -profile /Users/fred/images/profiles/USWebCoatedSwop.icc -profile /Users/fred/images/profiles/sRGB.icc test.png
test.png

Recipe to generate Windows ICO files with Graphicsmagick

Based on this question for imagemagick, what is the equivalent for graphicsmagick? Recipe for creating Windows ICO files with ImageMagick?
Also I just want to generate a fully transparent ico file with multiple sizes. I found that there's an xc:none option that works for both, but is there one single command that generates ico files with multiple sizes that is transparent? Otherwise I would have to first create a transparent png file, then create ico files from the png file.
AFAIK, GraphicsMagick doesn't support writing ICO format files - see here.
Just in case anyone knows more about this mad Microsoft format and if it is maybe some sort of multi-page TIF or GIF in disguise that just needs to be renamed, the following would be one way of making a recipe in GraphicsMagick:
#!/bin/bash
{ echo convert image.png mpr:initial;
echo convert mpr:initial -resize 16x16 mpr:16;
echo convert mpr:initial -resize 32x32 mpr:32;
echo convert mpr:initial -resize 48x48 mpr:48;
echo convert mpr:initial -resize 64x64 mpr:64;
echo convert mpr:16 mpr:32 mpr:48 mpr:64 -colors 256 favicon.tif; } | gm batch -prompt off
For the moment, I have created a multi-page TIF as the output file and it contains the four sizes you need - but as I said, GraphicsMagick will not write a ICO file.

GraphicsMagick Error: gm convert: profile matches sRGB but writing iCCP instead

When I try to convert a jpg image to a png, I get the following errors message occasionally. What does it mean?
> gm convert xxx.jpg png32:xxx.png
gm convert: profile matches sRGB but writing iCCP instead (xxx.png).
It's not an error but a warning.
Your input file (xxx.jpg) contains an ICC profile that represents sRGB. The png writer notices that, and issues a warning (because writing a 13-byte sRGB chunk is more efficient than writing a multi-kilobyte iCCP chunk). These days, even the sRGB chunk is wasteful if your image is intended to be displayed by a browser, because browsers assume that pixels are in the sRGB colorspace anyhow, when there is no color information present in the PNG file.

Resources