Resize failing for transparent images on IM 6.5.4-7
Resize failing for transparent images on IM 6.5.4-7
ImageMagick Version - 6.5.4-7 2012-04-10 Q16
We have a watermark image and we need to resize it in accordance with the image that we are trying to apply the watermark, so we get the Width and height of the original image and then using convert resize the watermark accordingly and apply it on the original image so it fits the complete image.
To Resize
convert -resize 1875x2500 Watermark.PSD[0] Watermark_resized.PSD
Apply Watermark
composite -dissolve 40% -gravity center Watermark_resized.PSD[0] OriginalImage.jpg. OutputImage.jpg
In this process of resizing the watermark on the output, the watermark is showing only a fog kind layer on original image without maintaining the transparency and also loosing the watermark data.
If watermark(psd) is not resized, the watermark is getting applied without any issue
composite -dissolve 40% -gravity center Watermark.PSD[0] OriginalImage.jpg. OutputImage.jpg
To test the version incompatibilities, we resized the image on ImageMagick 6.8.7-5 Q16 version and then tried composite on 6.5.4-7 2012-04-10 Q16, the watermark applied without issues.
How can we resize and apply watermark on 6.5.4-7 2012-04-10, as we have to do this specifically on this version only.
Also I see in the forum from bugs section that 6.8.8-2 version of ImageMagick is also having problems with composite command. So help me how to overcome this
OriginalImage
https://www.dropbox.com/s/674ne9m5bi7tz ... lImage.jpg
watermark.psd
https://www.dropbox.com/s/ewthmhzmzb6rxjt/watermark.PSD
OutputImage.jpg
https://www.dropbox.com/s/2ejw44k2vp84o ... ge.jpg.jpg
Watermark_resized.psd
https://www.dropbox.com/s/f1c0lvtdtrlh5 ... esized.PSD
We have a watermark image and we need to resize it in accordance with the image that we are trying to apply the watermark, so we get the Width and height of the original image and then using convert resize the watermark accordingly and apply it on the original image so it fits the complete image.
To Resize
convert -resize 1875x2500 Watermark.PSD[0] Watermark_resized.PSD
Apply Watermark
composite -dissolve 40% -gravity center Watermark_resized.PSD[0] OriginalImage.jpg. OutputImage.jpg
In this process of resizing the watermark on the output, the watermark is showing only a fog kind layer on original image without maintaining the transparency and also loosing the watermark data.
If watermark(psd) is not resized, the watermark is getting applied without any issue
composite -dissolve 40% -gravity center Watermark.PSD[0] OriginalImage.jpg. OutputImage.jpg
To test the version incompatibilities, we resized the image on ImageMagick 6.8.7-5 Q16 version and then tried composite on 6.5.4-7 2012-04-10 Q16, the watermark applied without issues.
How can we resize and apply watermark on 6.5.4-7 2012-04-10, as we have to do this specifically on this version only.
Also I see in the forum from bugs section that 6.8.8-2 version of ImageMagick is also having problems with composite command. So help me how to overcome this
OriginalImage
https://www.dropbox.com/s/674ne9m5bi7tz ... lImage.jpg
watermark.psd
https://www.dropbox.com/s/ewthmhzmzb6rxjt/watermark.PSD
OutputImage.jpg
https://www.dropbox.com/s/2ejw44k2vp84o ... ge.jpg.jpg
Watermark_resized.psd
https://www.dropbox.com/s/f1c0lvtdtrlh5 ... esized.PSD
Last edited by Carter J on 2014-02-05T22:03:10-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resize failing for transparent images on IM 6.5.4-7
This is the way IM handles PSD files with background transparency. It currently only used alpha channel transparency in PSD files. This has been reported and is being looked into. But most likely, there will not be any backward compatibility changes.
The only way I know now to handle it, is to open the psd file in Photoshop and convert to PNG or TIFF.
see
viewtopic.php?f=3&t=24905
The only way I know now to handle it, is to open the psd file in Photoshop and convert to PNG or TIFF.
see
viewtopic.php?f=3&t=24905
Re: Resize failing for transparent images on IM 6.5.4-7
I don't think so. Please read the below lines that I mentioned in my first postfmw42 wrote:This is the way IM handles PSD files with background transparency. It currently only used alpha channel transparency in PSD files. This has been reported and is being looked into. But most likely, there will not be any backward compatibility changes.
The only way I know now to handle it, is to open the psd file in Photoshop and convert to PNG or TIFF.
If watermark(psd) is not resized, the watermark is getting applied without any issue
composite -dissolve 40% -gravity center Watermark.PSD[0] OriginalImage.jpg. OutputImage.jpg
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Resize failing for transparent images on IM 6.5.4-7
You are using PSD as in intermediate format. Any particular reason? I would use PNG. Test it to ensure it has the transparency you expect.Carter J wrote:convert -resize 1875x2500 Watermark.PSD[0] Watermark_resized.PSD
snibgo's IM pages: im.snibgo.com
Re: Resize failing for transparent images on IM 6.5.4-7
Thanks, that workedsnibgo wrote:You are using PSD as in intermediate format. Any particular reason? I would use PNG. Test it to ensure it has the transparency you expect.Carter J wrote:convert -resize 1875x2500 Watermark.PSD[0] Watermark_resized.png
But any specific reason why ImageMagick is not able to handle PSD files
Re: Resize failing for transparent images on IM 6.5.4-7
PSD files are proprietary to Adobe - which would be my guess as to their varied support.
For what it's worth I would use the internal MPC format for intermediate steps to avoid compressing multiple times using multiple algorithms, or consider using an API and keeping everything in-memory.
Lastly, your watermark doesn't seem terribly complex -- you could do a semitransparent box and words directly inside IM, which would give you additional options on adjusting to varied image sizes. Just some options.
For what it's worth I would use the internal MPC format for intermediate steps to avoid compressing multiple times using multiple algorithms, or consider using an API and keeping everything in-memory.
Lastly, your watermark doesn't seem terribly complex -- you could do a semitransparent box and words directly inside IM, which would give you additional options on adjusting to varied image sizes. Just some options.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resize failing for transparent images on IM 6.5.4-7
This is very strange. I do not see how any part of your commands are working.
Neither the PSD file nor the png file show any transparency on my 6.8.8.4 Q16 Mac OSX system either via display or via identify -verbose image. It is behaving as I said before, at least for me, as if IM does not recognize the background transparency in the PSD file.
Also you can combine both your commands into one command by using convert rather than composite and using parenthesis processing.
But I still get 40% white background showing in the watermark area rather than full transparency, because IM does not see the background transparency and just uses white.
If on Windows, the use (...) rather than \(...\)
PS I went back to IM 6.7.5.5 (as far back as I can go) and the above command works just fine. No white is showing around the red letters. So at some point there was a change to reading PSD files and IM could read the background transparency. However, I think, this is to be fixed in IM 6.8.8.5. see viewtopic.php?f=3&t=24905
A further test of available versions shows that the change occurred first at IM 6.8.8.1
Code: Select all
convert watermark.PSD[0] watermark.png
Also you can combine both your commands into one command by using convert rather than composite and using parenthesis processing.
Code: Select all
convert OriginalImage.jpg \( Watermark.PSD[0] -resize 1875x2500 \) -gravity center -define compose:args=40 -compose dissolve -composite OutputImage.jpg
If on Windows, the use (...) rather than \(...\)
PS I went back to IM 6.7.5.5 (as far back as I can go) and the above command works just fine. No white is showing around the red letters. So at some point there was a change to reading PSD files and IM could read the background transparency. However, I think, this is to be fixed in IM 6.8.8.5. see viewtopic.php?f=3&t=24905
A further test of available versions shows that the change occurred first at IM 6.8.8.1
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Resize failing for transparent images on IM 6.5.4-7
I'll expand my comment: for temporary files I'd use PNG for development, and MIFF or MPC for production. PNG is readable by Gimp and common image viewers so it's easy to check the results are as expected. When it works, I switch to MIFF (for small images) or MPC (for large images), and test again. MIFF comes with or without compression. I "-compress none", but I haven't done speed trials.
PSD is not a widely supported format, and Adobe have only recently published the format, and I don't have Photoshop.
PSD is not a widely supported format, and Adobe have only recently published the format, and I don't have Photoshop.
snibgo's IM pages: im.snibgo.com
Re: Resize failing for transparent images on IM 6.5.4-7
Yes, it used to work in the earlier versions. Hopefully it will be fixed in IM 6.8.8-5fmw42 wrote: A further test of available versions shows that the change occurred first at IM 6.8.8.1
Re: Resize failing for transparent images on IM 6.5.4-7
Issue reproducible with IM 6.8.8.5fmw42 wrote: PS I went back to IM 6.7.5.5 (as far back as I can go) and the above command works just fine. No white is showing around the red letters. So at some point there was a change to reading PSD files and IM could read the background transparency. However, I think, this is to be fixed in IM 6.8.8.5. see viewtopic.php?f=3&t=24905
A further test of available versions shows that the change occurred first at IM 6.8.8.1
Re: Resize failing for transparent images on IM 6.5.4-7
It will be fixed in IM 6.8.8.6. There was a bug in writing the PSD file.