New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting the color depth on TIFF files written using the Wand API. #68
Comments
|
Modern releases of ImageMagick, by default, writes to an image format @ the same depth as the source image assuming the particular image format supports the depth. XBM, for example, only supports images of depth 1, regardless of the source image depth. This is by design. If you find that ImageMagick behaves differently, post a command-line illustrating the exception. |
|
Hi - What do you mean by modern? For instance, the issue above is valid on ImageMagick 6.7.7-10 (which is, btw, shipped w/ the latest release of Ubuntu LTS). |
|
When appending an image, the image depth is that of the first image. If your first image has a depth of 1, the output TIFF image has a depth of 1. We'll add a patch to fix this problem. In the mean-time, use setImageDepth(16) to ensure a depth of 16 bits-per-pixel. If it doesn't already, IMagick should also support setDepth(). setImageDepth() is specific to a particular image whereas setDepth() applies to all images in a sequence. |
|
I've just seen that this is a duplicate (or at least caused by the same desire) of #66 . Are you saying that setDepth() will always control the output image depth? |
|
@mikayla-grace |
|
Will setDepth() always control the output image depth? Well that depends on the output format. XBM, for example, is limited to a pixel depth of 1 so a setDepth(16) would still return an image of depth 1. ImageMagick typically sets the attributes of the destination image from the source image. Assume two images, the first of depth 1 and the second of depth 8. Write this to TIFF and the first image in the TIFF is of depth 1 and the second of depth 8. Whereas, if you call setDepth(8), both images in the TIFF file will be of depth 8. setImageDepth() has no effect unless setType() is specified? We'll need a specific use case that we can download and reproduce the problem before we can comment further. |
An example from the other issue is below. Yes, it is in PHP as I find that a lot easier to write than C. If absolutely necessary I can convert it to C. |
|
We have a patch in ImageMagick to fix this problem. Its a legacy issue specific to TIFF. setImageDepth() does not resolve the problem, instead use setImageType(), setDepth(), or install the latest GIT source. |
|
Are you referring to this patch? |
|
The patch sets the appended images depth to the maximum depth of any one image used to build the result. A different patch removes the TIFF legacy algorithm of automatically reducing a TIFF image to a depth of 1 if the image was determined to be grayscale / monochrome. |
|
Sweet. Thanks. |
The issue is well explained here.
Can you please clarify this for us?
The text was updated successfully, but these errors were encountered: