Resize the image without losing the quality of the image

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, helmut, xnview

punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Resize the image without losing the quality of the image

Post by punith8626 »

Hi,

I have a multi tiff image and I wanted to convert it to PNG
I have used below command to covert and resize. The out image loses its quality text is not visible properly.

Code: Select all

nconvert -page 0 -overwrite -out png -ratio -rflag orient -resize 50% 50% -o C:\Users\p\Desktop\tiff\1.png  C:\Users\p\Desktop\tiff\abc.tif
Is there any way to convert image without losing the quality ?

Regards
Punith
cday
XnThusiast
Posts: 4138
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Resize the image without losing the quality of the image

Post by cday »

punith8626 wrote:I have a multi tiff image and I wanted to convert it to PNG.

I have used below command to covert and resize. The out image loses its quality, text is not visible properly.

Code: Select all

nconvert -page 0 -overwrite -out png -ratio -rflag orient -resize 50% 50% -o C:\Users\p\Desktop\tiff\1.png  C:\Users\p\Desktop\tiff\abc.tif
Is there any way to convert image without losing the quality?
You are reducing the pixel dimensions of the image which will tend to reduce the quality, resampling using one of the -rtype options may help...
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: Resize the image without losing the quality of the image

Post by punith8626 »

How do i darken the text present in the image ?
cday
XnThusiast
Posts: 4138
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Resize the image without losing the quality of the image

Post by cday »

punith8626 wrote:How do i darken the text present in the image ?
You have various options including altering brightness, contrast or using a levels adjustment...

You have a copy of the NConvert help file, presumably?

If you wish and are able to, you could upload an example image.
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: Resize the image without losing the quality of the image

Post by punith8626 »

I need to make the marked area darker.
Here is the problem I am opening the image in internet explorer where image text is getting blur and not able to read when i resize.
Last edited by punith8626 on Wed Apr 25, 2018 12:16 pm, edited 3 times in total.
cday
XnThusiast
Posts: 4138
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Resize the image without losing the quality of the image

Post by cday »

Thanks for uploading an example image: may I make two comments:

First, in general in a case like this it would be easiest to find the optimum actions, and values to be used when relevant, using a windowed software such as XnView MP or XnView Classic, as settings can be tried quickly and the result seen immediately.

Second, do you really need to resize the original image (reduce the pixel dimensions), which will often inevitably reduce the image quality ? If the file size is an issue, there may be better ways of obtaining the result you need: I have attached a TIFF with CCITT G4 'Fax' lossless compression, which will open with image quality identical to the original image, but has a very much reduced file size.

Edit:

Your TIFF file is black and white (1-bit colour depth) which precludes darkening using the above methods, however there may be a way of obtaining some improvement by other means such as use of a filter. If he has time, XnTriq could possibly advise...

Otherwise, scanning or faxing the original paper with different settings would help, which may of course be outside your control.
--
Last edited by XnTriq on Mon Feb 26, 2018 8:00 pm, edited 1 time in total.
Reason: Attachment removed due to confidential information
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: Resize the image without losing the quality of the image

Post by punith8626 »

Thank you for your reply.
I am not resizing the image.When i try to open the same image in internet explorer,I am not able to read the image properly.
Here is the screenshot

The reason for darkening the text is in internet explorer I am not able to see the text.If you open the same text in internet explorer you can see the issue.

Could you please provide me the command that you have used to get less size CCIT Compression ?
Last edited by XnTriq on Mon Feb 26, 2018 8:00 pm, edited 1 time in total.
Reason: Attachment removed due to confidential information
cday
XnThusiast
Posts: 4138
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Resize the image without losing the quality of the image

Post by cday »

punith8626 wrote:When i try to open the same image in internet explorer,I am not able to read the image properly.

The reason for darkening the text is in internet explorer I am not able to see the text. If you open the same text in internet explorer you can see the issue.
I don't have Internet Explorer the web browser, you using a web browser to view files??
Could you please provide me the command that you have used to get less size CCIT Compression ?

Code: Select all

-c value          : Compression number
              default : 0 (uncompressed)
              PDF    : 1 (Fax), 2 (Rle), 3 (LZW), 4(ZIP), 5 (JPEG)
              TIFF    : 1 (Rle), 2 (LZW), 3 (LZW+Prediction)
                           4 (ZLIB)
                           5 (CCITT G3), 6 (CCITT G3-2D), 7 (CCITT G4) only B/W
                           8 (JPEG) only 24/32 bits
For TIFF with CCITT G4 compression use -c 7
User avatar
XnTriq
Moderator & Librarian
Posts: 6376
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Resize the image without losing the quality of the image

Post by XnTriq »

punith8626 wrote:I am not resizing the image.When i try to open the same image in internet explorer,I am not able to read the image properly.
Here is the screenshot

The reason for darkening the text is in internet explorer I am not able to see the text.If you open the same text in internet explorer you can see the issue.
Internet Explorer doesn't (always) use interpolation (high-quality zoom) for downsizing binary (black & white) images. You need to either hit Refresh in IE or increase the color depth of the image to at least 8-bit grayscale.
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: Resize the image without losing the quality of the image

Post by punith8626 »

XnTriq wrote:
punith8626 wrote:I am not resizing the image.When i try to open the same image in internet explorer,I am not able to read the image properly.
Here is the screenshot

The reason for darkening the text is in internet explorer I am not able to see the text.If you open the same text in internet explorer you can see the issue.
Internet Explorer doesn't (always) use interpolation (high-quality zoom) for downsizing binary (black & white) images. You need to either hit Refresh in IE or increase the color depth of the image to at least 8-bit grayscale.
Could you please provide me the command on how to increase the colordepth of image.?
User avatar
XnTriq
Moderator & Librarian
Posts: 6376
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Resize the image without losing the quality of the image

Post by XnTriq »

punith8626 wrote:Could you please provide me the command on how to increase the colordepth of image.?
cday?
[color=green]xnconvert.exe -help[/color] wrote:

Code: Select all

-grey num         : Convert in Grey Scale (256, 128, 64, 32, 16, 8 or 4)
jimbob ([url=http://newsgroup.xnview.com/viewtopic.php?p=1502#p1502]Make a droplet to convert color to grey as a BAT file[/url]) wrote:I successfully use the command line within a Windows DOS prompt to convert a color JPG to a greyscale JPG:

Code: Select all

nconvert -quiet -o output.jpg -grey 256 -out jpeg input.jpg
cday
XnThusiast
Posts: 4138
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Resize the image without losing the quality of the image

Post by cday »

XnTriq wrote:
punith8626 wrote:Could you please provide me the command on how to increase the colordepth of image.?
cday?
[color=green]xnconvert.exe -help[/color] wrote:

Code: Select all

-grey num         : Convert in Grey Scale (256, 128, 64, 32, 16, 8 or 4)
jimbob ([url=http://newsgroup.xnview.com/viewtopic.php?p=1502#p1502]Make a droplet to convert color to grey as a BAT file[/url]) wrote:I successfully use the command line within a Windows DOS prompt to convert a color JPG to a greyscale JPG:

Code: Select all

nconvert -quiet -o output.jpg -grey 256 -out jpeg input.jpg
To increase colour depth, presumably these although I don't think ever used them myself:

Code: Select all

-grey num         : Convert in Grey Scale (256, 128, 64, 32, 16, 8 or 4)

-truecolors
-truecolours      : Convert in True Colors
I'm attaching a copy of the NConvert 7.00 Help file, you really should have one to consult.
You do not have the required permissions to view the files attached to this post.
User avatar
XnTriq
Moderator & Librarian
Posts: 6376
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Resize the image without losing the quality of the image

Post by XnTriq »

cday wrote:To increase colour depth, presumably these although I don't think ever used them myself:

Code: Select all

-grey num         : Convert in Grey Scale (256, 128, 64, 32, 16, 8 or 4)

-truecolors
-truecolours      : Convert in True Colors
I'm attaching a copy of the NConvert 7.00 Help file, you really should have one to consult.
I actually had consulted the help (nconvert.exe -help >nconvert.txt) for my previous post (see quote).
The reason why I was asking for your assistance is that the sample was deleted by the OP before I joined the thread.

Anyhow — the following command does the trick for me:

Code: Select all

nconvert.exe -o test.png -grey 256 -out png file0_0_CCITT_G4.tif
cday
XnThusiast
Posts: 4138
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Resize the image without losing the quality of the image

Post by cday »

XnTriq wrote:I actually had consulted the help (nconvert.exe -help >nconvert.txt) for my previous post (see quote).
The reason why I was asking for your assistance is that the sample was deleted by the OP before I joined the thread.
My remark wasn't addressed at you... :wink:
User avatar
XnTriq
Moderator & Librarian
Posts: 6376
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Resize the image without losing the quality of the image

Post by XnTriq »

cday wrote:My remark wasn't addressed at you... :wink:
Oh, got it :mrgreen: