Page 1 of 2

Problems with resizing a previously rendered label

Posted: 2017-02-13T21:01:07-07:00
by GarbageSauce
Okay so I have the newest version of ImageMagick installed on Windows 10 Pro 64-bit. I run this command

magick -background none -fill #ff0000 -font Arial -size x90 -gravity center label:"ALBUQUERQUE" png32:C:\Users\Nope\Desktop\asdf.png

And then I resize it (note that this command is applied to a crapton of labels all at difference sizes)

magick C:\Users\Nope\Desktop\asdf.png -resize 240x90^>! C:\Users\Nope\Desktop\asdf.png

If you run this command, you will see that the resized image looks all aliased and gross. Is there a way to keep this from happening?

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T21:11:15-07:00
by snibgo
The result I get isn't aliased.
Image
The image has been halved in width, so the letters are narrowed and pushed together. It may look better if you choose a font that already has narrow letters.

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T21:14:06-07:00
by GarbageSauce
Wait. How are you getting a different result than me?

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T21:18:53-07:00
by fmw42
What is your exact IM version? What do you get from

Code: Select all

convert -version
Perhaps you have an older delegate for freetype or fontconfig?

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T21:21:33-07:00
by fmw42
I think your problem is with 240x90^>! I do not think you can use ! with ^>. They mean two different things.

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T21:22:05-07:00
by fmw42
On windows ^ is a special character an I think needs escaping as ^^

Or were you just escaping > as ^>?

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T21:25:34-07:00
by GarbageSauce
The -resize -240x90^>! argument is there simply to resize any images LARGER than 240x90 pixels down to 240x90 pixels without paying regard to the aspect ratio. If I remove the caret, it doesn't seem work properly.

And here is what magick -version returned
Image

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T21:32:27-07:00
by fmw42
The carat in IM means to display to conform to the smaller dimension. The > means only if the image is greater than that size. The ! means exactly to the dimensions you have. But in Windows, the ^ has a special meaning as an escape character. So your command as written is confusing to me and perhaps IM on Windows. In Windows syntax, you are escaping the >. Perhaps that is what you want. If you want it to check the smaller dimension, then it would need to be ^^>!

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T21:37:08-07:00
by fmw42
In unix (IM 7.0.4.7 Q16 Mac OSX), with the following, I get:

Code: Select all

magick -background none -fill "#ff0000" -font Arial -size x90 -gravity center label:"ALBUQUERQUE" png32:asdf.png

Code: Select all

magick asdf.png -resize 240x90>! tmp.png
This assumes you are not interested in conforming to the smaller dimension via ^ ( or in windows ^^)

Image

If you are, then I use:

Code: Select all

magick asdf.png -resize 240x90^>! albuqueque2.png
Image

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T22:07:59-07:00
by GarbageSauce
Okay let me re-explain. If the input image is larger than 240x90 pixels, resize to 240x90 pixels without respecting the aspect ratio. Here are all forms of arguments I tried.

240x90>!
Image
The dimensions are 240x37 so nope. Bad combo.

240x90^>!
Image
Dimensions are 240x90 so yes. This is what we want.... except that the output is downright ugly.

240x90^^>!
Image
Dimensions are 590x90. Identical to the original. Nope.

240x90>^!
Image
Dimensions are 240x37. Same as the first resize.

240x90\>!
Image
Dimensions are 240x37. Same as above.

240x90>\!
Returns Access is Denied. I'm guessing this isn't the way to go.

I'm not entirely sure what is going on.

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T22:14:42-07:00
by fmw42
You appear to be on Windows from your C:\. So you need to use Windows syntax. In Windows ^ is escape and so your original command was escaping the >. If you really want the IM ^, then you must escape it to ^^. See http://www.imagemagick.org/script/comma ... p#geometry for the meaning of ^, >, ! in IM.

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T22:20:13-07:00
by GarbageSauce
Okay let's start from scratch. If I want to resize the image to 240x90 without respecting the aspect ratio and while retaining image quality, how do I make it so. I only stuck with the caret because it got my image down to the desired dimensions but I just couldn't figure out why it looked hideous.

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T22:25:55-07:00
by snibgo
What happens when you use just a "!" ? What does your original look like, before resizing?

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T22:34:31-07:00
by GarbageSauce
Here is the original
Image

Just doing -resize 240x90! gets me this
Image
The dimensions are 240x90 which is exactly what I want. I just can't have it looking like garbage.

This image was done on a different computer running a different version of IM with a different and less stable font although the process was identical.
Image
I did try using this font on my computer with the newest release of IM and it looks like garbage.

Re: Problems with resizing a previously rendered label

Posted: 2017-02-13T22:56:31-07:00
by fmw42
Check your version of freetype? Also perhaps you got a bad set of glyphs in the Arial font you downloaded or are using. I do not see aliasing except in your middle imager above. Perhaps your arial font is set to Arial narrow?. Check your fonts by

Code: Select all

convert -list font
You can find your version of freetype by

Code: Select all

convert -list format

TTC* TTF r-- TrueType font collection (Freetype 2.6.5)
TTF* TTF r-- TrueType font (Freetype 2.6.5)