Canvas resize

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

Moderators: XnTriq, helmut, xnview

oirom

Canvas resize

Post by oirom »

Until now, i was using EyeBatch and IrfanView, i'm changing for XnView.

I want to resize my images in 144x44 px (keeping the ratio) and enlarge the canvas to 144x44 with white background.

I can enlarge canvas with XnView, but it doesn't work with nconvert.

my comand :
nconvert -q 60 -rtype lanczos -resize 144 44 -ratio -canvas 144 44 -o min_%.jpg *.jpg


bravo pour ce programme Pierre.

christophe.
User avatar
xnview
Author of XnView
Posts: 44470
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Canvas resize

Post by xnview »

oirom wrote:I want to resize my images in 144x44 px (keeping the ratio) and enlarge the canvas to 144x44 with white background.

I can enlarge canvas with XnView, but it doesn't work with nconvert.

my comand :
nconvert -q 60 -rtype lanczos -resize 144 44 -ratio -canvas 144 44 -o min_%.jpg *.jpg
What happens?
Try :
nconvert -q 60 -rtype lanczos -ratio -resize 144 44 -canvas 144 44 -o min_%.jpg *.jpg
Pierre.
oirom

Re: Canvas resize

Post by oirom »

xnview wrote: What's happened??
Try :
nconvert -q 60 -rtype lanczos -ratio -resize 144 44 -canvas 144 44 -o min_%.jpg *.jpg
Pierre.
The canvas function doesn't enlarge my images to 144 x 44 (X or Y is smaller).

This last command gives the same error.

christophe.
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: Canvas resize

Post by helmut »

oirom wrote:This last command gives the same error.
What does the error message say?
RobDavenport
Posts: 2
Joined: Thu Jul 29, 2004 2:57 pm
Location: Cleveland, Ohio USA

Similar trouble with resize or canvas in nconvert

Post by RobDavenport »

I've been trying to convert some jpgs to ico's and having trouble with the resizing. It seems to work in XNView, but not nconvert.

In XNView I do a "Convert..." on a 500x352 sized jpg.
In the advanced operations I:
- apply Convert to Colors 256
- then add Resize to 256 x 256, checked "Keep Ratio",
(with defaults: Resample "Bilinear", the incr/decr options unchecked)
- then add "Resize Canvas" to 256 x 256
(with defaults: Keep Ratio UNchecked, position Centered, color black)

I get an .ico file, 256x256 w/256 colors with the image resized as I expect with two black bands across the top and bottom (as expected).

I exported the conversion steps to a bat file and got this:

nconvert -npcd 2 -size 256x256+0 -ctype grey -corder inter -out ico -colors 256 -ratio -rtype linear -resize 256 256 -canvas 256 256 "D:\Documents and Settings\rgdavenp\My Documents\My Pictures\ranger_og.jpg"

I added the '-v' parameter before the -npcd and got this output
(I'm trimming the long file names but they were there):

------------------------------------------------------------------
A JPEG TrueColor (v1.1) (RGB) - JPEG was recognized : ranger_og.jpg
Width:500 Height:375 with 16777216 colors
Nplanes : 1 Bitscount : 24
Bytes Per Plane : 1500
xdpi : 68 ydpi : 68
Converting in Colors...
Resizing... Resizing canvas...
Windows Icon was writen : ranger_og.ico
Width:256 Height:192 with 256 colors

Conversion of ranger_og.jpg into ranger_og.ico OK
------------------------------------------------------------------

It seems the resizing of the canvas is not working in nconvert, similar to oirom's problem. The resulting ico is 256x192 not 256x256 with black bands where the canvas should've been expanded. Showing the icon in Windows explorer results in it squishing it to fit 32x32 and the ratio is then incorrect.

Putting the -canvas command before the -rtype resulted in another 256x192 image but it was not resize, just cropped.


Any suggestions on what I might be doing wrong, or if this is a bug?

Thanks,

Rob
User avatar
xnview
Author of XnView
Posts: 44470
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Similar trouble with resize or canvas in nconvert

Post by xnview »

RobDavenport wrote:It seems the resizing of the canvas is not working in nconvert, similar to oirom's problem. The resulting ico is 256x192 not 256x256 with black bands where the canvas should've been expanded. Showing the icon in Windows explorer results in it squishing it to fit 32x32 and the ratio is then incorrect.
Ok, right a :bugconfirmed:
The problem is -ratio
Pierre.
RobDavenport
Posts: 2
Joined: Thu Jul 29, 2004 2:57 pm
Location: Cleveland, Ohio USA

Post by RobDavenport »

OK, if it's a bug, I'll just sit back and wait patiently for a version with the fix.
Thanks for identifying it.

Rob