Upscaling

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?".
Post Reply
steve___
Posts: 28
Joined: 2012-07-17T09:52:07-07:00
Authentication code: 15

Upscaling

Post by steve___ »

I have images similar to this: http://imgur.com/189v5 Their widths are between 1000px and 1200px. I'd like to upscale them to a width of 1280px. In my first attempt I tried:

$ convert -resize 1280 a.jpg b.jpg

The picture was slightly blurry. I googled around and came across '-unsharp -30':

$ convert -resize 1280 -unsharp -30 a.jpg b.jpg

This seems to work well. I was wondering if this was the best way. I'd like to keep the colours the same and the picture as sharp as the original.

Thanks,
-steve
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Upscaling

Post by fmw42 »

proper syntax, which may or may not make any change is to put the input image right after convert, then the options/commands, then the output.

unsharp radiusxsigma should really be done by radius=0 and sigma. That way radius defaults to about 3xsigma, which allows the gaussian used within to roll off to near zero; otherwise, you may be getting a truncated gaussian.

For resizing you can choose some other filter, such as Catrom, Lagrangian or various Lanczos options and control the sharpness via a -define for blur. That may also help sharpening to magnified image.

see
http://www.imagemagick.org/Usage/basics/#cmdline
http://www.imagemagick.org/script/comma ... php#resize
http://www.imagemagick.org/script/comma ... p#geometry
http://www.imagemagick.org/script/comma ... s.php#blur
http://www.imagemagick.org/Usage/resize/
http://www.imagemagick.org/Usage/distorts/#resize

Note there has been some futher discussion about resizing to enlarge at
viewtopic.php?f=22&t=21435
viewtopic.php?f=22&t=21415&start=30
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Upscaling

Post by anthony »

You are doing what is known as USM resize, a photoshop resize method.
See IM examples, Resize with Sharpening
http://www.imagemagick.org/Usage/resize/#resize_unsharp
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply