Error resize with the height

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
lcalero
Posts: 4
Joined: 2018-09-21T03:31:18-07:00
Authentication code: 1152

Error resize with the height

Post by lcalero »

My images

Image

Command

Code: Select all

magick mogrify -resize x600 *.jpg
result

Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error resize with the height

Post by snibgo »

What version of IM, on what platform? It seems to work fine on v7.0.7-27 on Windows 8.1:

Code: Select all

f:\web\im>%IMG7%magick -size 2322x4128 xc: -resize x600 info:

xc: XC 338x600 338x600+0+0 16-bit sRGB 2.906u 0:00.562
snibgo's IM pages: im.snibgo.com
lcalero
Posts: 4
Joined: 2018-09-21T03:31:18-07:00
Authentication code: 1152

Re: Error resize with the height

Post by lcalero »

last version 7.0.8-11 on Windows 10

but I can not specify the height that there are several folders with different sizes
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error resize with the height

Post by fmw42 »

Post one of the images that fail
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error resize with the height

Post by fmw42 »

This command works fine for me on IM 7.0.8.11 Q16 Mac OSX.

Code: Select all

magick mogrify -resize x600 temp.jpg
lcalero
Posts: 4
Joined: 2018-09-21T03:31:18-07:00
Authentication code: 1152

Re: Error resize with the height

Post by lcalero »

Here you have the images to prove what happens

https://mega.nz/#!tl41WJgD!FR9jPsfDD4K7 ... u-wAVeuM_Q
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error resize with the height

Post by fmw42 »

I tested all your images using Imagemagick 7.0.8.11 Q16 Mac OSX Sierra with

Code: Select all

magick mogrify -resize x600 -format jpg -path ../images2 *
All your landscape format images ended up with height = 600. The two portrait image ended up with width = 600.

This is the same whether I use IM 6.9.10.11 or simply magick or convert rather than mogrify.

Is this not what you get?

It is unclear to me if there is a bug or not depending upon what was meant at https://imagemagick.org/script/command- ... p#geometry for xheight. But I would have interpreted that such that portrait mode images also should end up with a height of 600 and the width adjusted to preserve the aspect.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Error resize with the height

Post by dlemstra »

I suspect that your issue is the way your file explorer shows the file information due to exif information. The following happens with a resize:

Code: Select all

identify *
b3skpyik.jpg JPEG 4128x2322 4128x2322+0+0 8-bit sRGB 2.12903MiB 0.016u 0:00.016
c4ldzu3g.jpg JPEG 4128x2322 4128x2322+0+0 8-bit sRGB 2.19882MiB 0.000u 0:00.010
edwajmtl.jpg JPEG 4128x2322 4128x2322+0+0 8-bit sRGB 2232190B 0.016u 0:00.007
ga5xzgx4.jpg JPEG 4128x2322 4128x2322+0+0 8-bit sRGB 1.74217MiB 0.016u 0:00.006
jq1eefjp.jpg JPEG 4128x2322 4128x2322+0+0 8-bit sRGB 1.98368MiB 0.000u 0:00.006
lgeqsv2v.jpg JPEG 4128x2322 4128x2322+0+0 8-bit sRGB 1.99106MiB 0.000u 0:00.003
n5qkw1m4.jpg JPEG 4128x2322 4128x2322+0+0 8-bit sRGB 2.25829MiB 0.016u 0:00.003
s2k0xo3o.jpg JPEG 4128x2322 4128x2322+0+0 8-bit sRGB 2.28454MiB 0.000u 0:00.003
srh30kca.jpg JPEG 4128x2322 4128x2322+0+0 8-bit sRGB 1.75434MiB 0.000u 0:00.003
vphupvfs.jpg JPEG 4128x2322 4128x2322+0+0 8-bit sRGB 2.25829MiB 0.000u 0:00.003

magick mogrify -resize x600 *.jpg

identify *
b3skpyik.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 216177B 0.016u 0:00.003
c4ldzu3g.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 227800B 0.000u 0:00.003
edwajmtl.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 221884B 0.000u 0:00.003
ga5xzgx4.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 159899B 0.000u 0:00.003
jq1eefjp.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 179389B 0.000u 0:00.003
lgeqsv2v.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 156541B 0.016u 0:00.003
n5qkw1m4.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 230236B 0.000u 0:00.003
s2k0xo3o.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 235217B 0.000u 0:00.003
srh30kca.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 179280B 0.016u 0:00.003
vphupvfs.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 230236B 0.000u 0:00.003
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error resize with the height

Post by snibgo »

I can't download and work my way through a 20 MB rar. Perhaps the "portrait" format images are so only because they have that orientation metadata, and IM sees them as "landscape".
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error resize with the height

Post by fmw42 »

Dirk,

I get your same values. But Mac Preview shows two portrait mode images with width=600.

I think the issue is that there is EXIF orientation information for lgeqsv2v.jpg which is RightTop. It looks like Imagemagick identify is reading the file size without reoriented and my Mac PREVIEW is reorienting it. That may be why identify shows all files as height 600, but PREVIEW shows the ones that get reoriented to portrait as width=600.

So if I do

Code: Select all

convert -auto-orient * info:
b3skpyik.jpg[0] JPEG 1067x600 1067x600+0+0 8-bit sRGB 0.000u 0:00.039
c4ldzu3g.jpg[1] JPEG 1067x600 1067x600+0+0 8-bit sRGB 0.010u 0:00.029
edwajmtl.jpg[2] JPEG 1067x600 1067x600+0+0 8-bit sRGB 0.010u 0:00.029
ga5xzgx4.jpg[3] JPEG 600x1067 600x1067+0+0 8-bit sRGB 0.010u 0:00.029
jq1eefjp.jpg[4] JPEG 1067x600 1067x600+0+0 8-bit sRGB 0.010u 0:00.029
lgeqsv2v.jpg[5] JPEG 600x1067 600x1067+0+0 8-bit sRGB 0.010u 0:00.029
n5qkw1m4.jpg[6] JPEG 1067x600 1067x600+0+0 8-bit sRGB 0.010u 0:00.029
s2k0xo3o.jpg[7] JPEG 1067x600 1067x600+0+0 8-bit sRGB 0.010u 0:00.029
srh30kca.jpg[8] JPEG 1067x600 1067x600+0+0 8-bit sRGB 0.010u 0:00.029
vphupvfs.jpg[9] JPEG 1067x600 1067x600+0+0 8-bit sRGB 0.010u 0:00.029
Now two images show width=600.

Note that IM 7 fails to allow the -auto-orient.

Code: Select all

magick -auto-orient * info:
magick: no images found for operation `-auto-orient' at CLI arg 1 @ error/operation.c/CLIOption/5251.

This would seem to be an oversight bug.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error resize with the height

Post by snibgo »

That's not a bug. V7 doesn't allow image operations before reading images. So this works fine:

Code: Select all

magick *.jpg -auto-orient info:
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error resize with the height

Post by fmw42 »

My misunderstanding. I thought it was a setting that had to be before reading the image. Thanks
lcalero
Posts: 4
Joined: 2018-09-21T03:31:18-07:00
Authentication code: 1152

Re: Error resize with the height

Post by lcalero »

Thanks to all!! I already found the solution


I used

Code: Select all

magick mogrify -auto-orient -resize x600 *.jpg
and it worked

Code: Select all

b3skpyik.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 216221B 0.000u 0:00.000
c4ldzu3g.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 227776B 0.000u 0:00.001
edwajmtl.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 221882B 0.000u 0:00.000
ga5xzgx4.jpg JPEG 338x600 338x600+0+0 8-bit sRGB 62626B 0.000u 0:00.000
jq1eefjp.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 179380B 0.016u 0:00.000
lgeqsv2v.jpg JPEG 338x600 338x600+0+0 8-bit sRGB 61449B 0.000u 0:00.000
n5qkw1m4.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 230164B 0.000u 0:00.000
s2k0xo3o.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 235210B 0.016u 0:00.000
srh30kca.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 179317B 0.000u 0:00.000
vphupvfs.jpg JPEG 1067x600 1067x600+0+0 8-bit sRGB 230164B 0.000u 0:00.000
Post Reply