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
BMP resize and convert troubleshoot #6877
Comments
As you have IM v7, I suggest using a.bmp has transparency. Transparent pixels are transparent white.
Transparent white pixels are changed to transparent black. You can change these to transparent white like this:
Or, if you want to remove transparency, you can flatten against white (or any other colour):
In what way? The output is 24x24 pixels, as expected.
But bv6.bmp has no transparency. As the input has transparency, we would expect the output to have transparency, unless you change that as I show above. |
Thanks for the help. Above is 'magick a.bmp -resize 24x24 -background White -alpha background out.bmp'.
This means that internally the alpha channel impacts and modifies the rgb channels. |
What do you mean by "awful"? What don't you like about it? What change would make it less awful?
You can separate the channels, resize each one, and re-combine them:
|
|
What program are you using to show the "nice" and "awful" results? We can do something similar with ImageMagick:
This is The first of the 5 squares has transparency. They all look "nice" to me. |
Thanks for all your help.
I am viewing the result with photoshop. Curiously, I didn't get the same results using 'magick out.bmp ( +clone -channel RGBA -separate +channel ) +append +repage sep.png', and as you can see, the rgb channels are scrambled. This is different from yours. |
Your result is bad. My IM version is:
I don't know why your result is bad. Try saving to PNG instead of BMP. Is the result good or bad? Is your installation a pre-built binary, from the IM website, or did you build it yourself? Try a build with Q16 instead of Q8. |
I suggest trying with this command first:
|
Recompile the solution using MAGICKCORE_QUANTUM_DEPTH 16
I've got the same result using 'magick out.bmp ( +clone -channel RGBA -separate +channel ) +append +repage sep.png' With the same package, I use 'set MAGICK_OCL_DEVICE=false', then the result is the same. Is this can be related to channel-mask (64-bit) or another features that is enabled ? |
OpenCL is disabled by default in recent builds. It comes with support for OpenCL but you will need to enable it to use it. |
Just try it (even if I think this is not related to the issue reported here) I got an abort call: |
That is probably a problem with your videocard / driver. I will check if I can reproduce this tomorrow. |
There has been a recent change: the Anyhow, a workaround is to use We can clamp just the alpha channel with " |
Cleaning the solution and recompiling the whole project has solved the abort call related to opencl. But I remember that the problem of the issue concerns the resize operation.
@snibgo magick operation gives
The same operation with my magick package gives:
|
For me, there is no problem with IM v7.1.1-20, but there is with v7.1.1-22. See my post above. The problem occurs when we have ...
A workaround is to replace this with:
|
@snibgo sorry I miss your comment.
Whatever the command, the resize result is bad. I am not sure resize choice are reasonable :-( and I still think this is a bug may be involved by the different compilation option. Can this be due to Features: Channel-masks(64-bit) ?
The result is: |
I haven't experimented with this feature, but I doubt that is the cause. We can fix the pixels you don't like by setting any alpha less than 0.02 (on a scale of 0.0 to 1.0) to 0.0.
With this |
I will make a try disabling that feature.
This does not explain why we've got differences between our two magick command. Don't you think the command is a bit complicated for such a simple operation? To process icons, I use image magick's C interface. I'll keep you posted once the 64-bit alpha has been deactivated... |
I recompile disabling 64 bits alpha.
Using
So our difference are not due to the 64-bit alpha feature. May I send you my magick command as private message? So we might check if that can be related to a computer specific conf? |
ImageMagick version
7.1.1.21
Operating system
Windows
Operating system, version and so on
Windows 11
Description
I am using imagemagick (7.1.1.21) to load some icon in a.bmp icon, resize it and output a b.bmp image.
I use the following command
convert a.bmp -resize 24x24 b.bmp
You can find attached the input / output files.
There's 2 problems:
I tried to force loading using bmp2, bmp3 format without success.
Using the same command with imagemagick V6 gave correct results (cf bv6.bmp attached).
Questions:
Is there something new introduced in V7 that explains the output?
If so, what should be the correct command?
Note: the following command give something similar to V6. But a bit complicated for a simple reduction operation, isn't it?
convert a.bmp -channel a -negate -channel rgba -define filter:blur=0.1 -resize 24x24 b.bmp
Steps to Reproduce
Simply use
convert a.bmp -resize 24x24 b.bmp
with the provided imageImages
images.zip
The text was updated successfully, but these errors were encountered: