Page 1 of 1

Resizing images without losing sharpness/quality

Posted: 2018-06-01T05:38:00-07:00
by benjamin10
Hello everyone!
I am quite new here, but working for many years with imagemagick (rudimentary ;) ).
My aim is to render pictures as to get the following specs:

- Size: 105x140mm
- Normalized
- very sharp

I tried it with the following command:
mogrify -normalize -resize 298x397 -quality 100% *.jpg
The problem is that the images get the right size but the quality/sharpness is too bad for my aims. I need the images for protocols, so they should be very sharp. In the end i want to use the images in libreoffice impress. Any hints for me?

In the past I used:
mogrify -normalize -resize 1280x1024 *.jpg
I then used the images in libreoffice impress but had to resize every picture by hand, which is a lot of work ;) (I am making a lot of protocols ;) ) The quality of the pictures did work in this method but it is time consuming!

Re: Resizing images without losing sharpness/quality

Posted: 2018-06-01T06:18:21-07:00
by snibgo
Please say what version of IM you use, on what platform.

It would help if you linked to some example inputs, and what you have tried so far.
benjamin10 wrote:... but the quality/sharpness is too bad for my aims. I need the images for protocols, so they should be very sharp.
What type of images are these? Photos or graphics? Are you resizing down or up? Do you want to add more sharpness than is in the input images? Have you tried for example "-unsharp"?

If you are resizing photos down, eg for the web, I like the technique shown in Resampling with halo minimization. This sharpens without much side-effect such as halos.

Re: Resizing images without losing sharpness/quality

Posted: 2018-06-06T06:34:27-07:00
by benjamin10
I use
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114
On Kubuntu 18.04

Okay here are some sample pics in their original sizes (from different Cams/Smartphones):
https://owncloud.usedandabused.at/index ... zaCavYuQmh
Are you resizing down or up?
I want to resize them down, but as i write this it comes to my mind maybe it is not "resizing" the pictures but "compressing" them to 105x140mm so that the resolution stays the same, were as the size changes... Is this correct?
Have you tried for example "-unsharp"?
I tried it with:

Code: Select all

mogrify -normalize -resize 298x397 -quality 100% *.jpg && mogrify -unsharp 397x298 *.jpg 
But the result is too pixelated. (See here: https://owncloud.usedandabused.at/index ... RAZTBLtLgC)

The thing is that when i resize the pictures to say 1024x768 and edit them in libreoffice impress within the protocoll (make them smaller and place them into the right position) the resolution/quality of the picture is still very good. The pictures are still sharp and in good quality (see: https://owncloud.usedandabused.at/index ... MlMfx3i9Tg)

Re: Resizing images without losing sharpness/quality

Posted: 2018-06-06T06:52:30-07:00
by snibgo
benjamin10 wrote:-unsharp 397x298
Typical unsharp settings are "0x1" or "0x5" for a heavy effect. Your setting will give horrible results.
benjamin10 wrote:I want to resize them down, but as i write this it comes to my mind maybe it is not "resizing" the pictures but "compressing" them to 105x140mm so that the resolution stays the same, were as the size changes... Is this correct?
If you don't want to change the number of pixels, but simply the size in mm, use a suitable "-density" setting.

Re: Resizing images without losing sharpness/quality

Posted: 2018-06-13T09:29:56-07:00
by benjamin10
Okay thank you for help. -density option did the trick!
This is the command I am using to get the desired images:

Code: Select all

mogrify -unsharp 0.25x0.25+8+0.065 -resize 1280x1024 -normalize -density 180 *.jpg 
If someone find it helpful here is the script I am using as a dolphin script to copy the originals and downsize them:

Code: Select all

#!/bin/bash

#Create a new folder and copy the content of the current folder to the new folder
mkdir small
cp *.jpg small
cp *.JPG small
cd small

#Unsharp, Resize and change the density to the right size (in my case: ~100x14mm) as to use them in powerpoint, libreoffice impress for flipchart protocolls. If you want to change the size do not change the resolution but the density parameter.
for i in *.jpg; do
 if [ -e "$i" ]; then
   file=`basename "$i" .jpg`
   mogrify -unsharp 0.25x0.25+8+0.065 -resize 1280x1024 -normalize -density 180 "$i"
 fi
done

for i in *.JPG; do
 if [ -e "$i" ]; then
   file=`basename "$i" .JPG`
   mogrify -unsharp 0.25x0.25+8+0.065 -resize 1280x1024 -normalize -density 180 "$i"
 fi
done