Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Hi all, new to Imagemagick and loving it so far. Thanks in advance for any help!
ImageMagick version: 7.0.5-Q16-HDRI for Windows
I have an image of a sphere that was created in a 3d studio max (Lime_Correct). Nowadays these renderers have a cool feature where you can break a rendered image into its raw components, in this case the base color of the sphere (Lime_SourceColor) and the shadows that fall on it (Lime_Shadows) and then recombine in post-production.
I'm able to achieve this in Photoshop by layering the two images and using a 'Multiply' blending mode. But when I try to recreate in ImageMagick I can't duplicate the effect (the composited image does not match the original, colors are off). Here is the command I was using:
To match the original render, I know the underlying component images must be 32-bit, in this case I'm using 32-bit TIFs
I thought perhaps it was a colorspace issue but I've tried every combination of RGB and sRGB in the above code and nothing gets output exactly correct
Not sure if this is some limitation of ImageMagick's ability to work with 32-bit images, but assume it was probably my noobish understanding of colorspaces
All the files I'm using are below if anyone wants to take a look
The difference is isolated to the edge of the sphere and the internal part of the sphere is the exact color of your reference image, Lime_Correct.tif.
The Windows version of ImageMagick is running libtiff 4.0.4. Perhaps that accounts for the differences you are seeing. We are upgrading the TIFF library to 4.0.8 in the next point release of ImageMagick this weekend. You could 7.0.5-8 when it is released and see if it fixes the problem.
Thanks for the quick reply! I was just opening the two files in photoshop and comparing them visually, maybe I was looking at two different colorspaces in photoshop and that's why they looked different on my screen. Will run a couple more tests when I get home tonight and see what I come up with.
Now that I have the first part working, I'm trying to recreate the Lime_SourceColor.tif using its two color components (black, green) and an alpha mask (see illustration below):
Having trouble though figuring out how to match the colors in 32-bit and can't get an exact duplicate of the original. Here is the code I was using:
What is the best way to go about identifying the rgb values of the two colors in the TIF so that I can then manually input them? Files I'm using are attached below:
I am not sure I understand or follow all this. But I just want to make a point. Perfect green in ImageMagick is not green, but either green1 or lime or rgb(0,255,0). So you may be getting different colors building in ImageMagick from Photoshop, if you specify green in ImageMagick. If this is not the case for your problem, then please ignore my comments.
I presume you have checked the colorspaces. ImageMagick defaults to sRGB, while Photoshop defaults to AdobeRGB. I would recommend for best viewing across different viewers that you assign a common profile to your images.
Thanks for the reply and sorry my original post wasn't clear. I believe this is a colorspace issue like you said, I am just a complete novice at dealing with them in ImageMagick. What I'm trying to do is:
Recreate an existing 32-bit tif file -- Lime_SourceColor.tif which I have a link to above
The image consists of a solid black background and a solid green sphere
I have an alpha mask (Lime_Alpha.tif) to delineate the background from the sphere
I want to create two solid canvases, one that matches the color of the black background and one that matches the color of the green sphere
I can then use the Lime_Alpha.tif as a mask on the green canvas and composite to recreate the original Lime_SourceColor.tif
I'm not sure how to extract the color information from the green sphere so I can properly reproduce it on a solid canvas (aside from opening Photoshop and using the eyedropper which, like you said, doesn't seem to give consistent RGB values between PS and Imagemagick)
To try to make things simpler I cropped the green area from Lime_SourceColor down to a 1x1 pixel 32-bit tif (link below). When I run "identify -verbose" on it I get a ton of color information (see bottom) but I'm not sure how to take that information and apply it to the creation of a new canvas that will match the color/colorspace of the original.
For example, if I just wanted to recreate this 1x1 pixel green tif, what is the proper ImageMagick command to do so?
For your lime source color image that is green surrounded by black, you can turn black to alpha and then scale the image to 1x1 and get the resulting pixel: value. It will compute the average of all non-transparent pixels. So