no output using crop

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?".
laser-axel
Posts: 7
Joined: 2017-04-24T23:36:49-07:00
Authentication code: 1151

no output using crop

Post by laser-axel »

Hello,

I am using image magick within cygwin (Version: ImageMagick 6.9.5-7 Q16 x86_64 2016-08-27) to convert the image data to text output. The text output is parsed by some awk script to do some calculations.
It seems suddenly (poosibly some update) the script stopped working because image magick does not create any output. I tracked down the problem that image magick does not produce any output when using -crop.

==================
$ identify bad_pos_P1.png
bad_pos_P1.png PNG 1440x900 1440x900+0+0 8-bit sRGB 564KB 0.000u 0:00.030

$ convert.exe bad_pos_P1.png test_do-noting.png

$ convert.exe bad_pos_P1.png -crop 500x500+100+100 test_crop.png

$ ls -l test*
-rw-rw-r--+ 1 aheinrici Domain Users 469608 25. Apr 08:47 test_do-noting.png

$
===================
There is no file test_crop.png. There is no output when the output file is "text:-". There is no output when the input image is .jpg.

I have absolutely no clue what is goint on?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: no output using crop

Post by snibgo »

bad_pos_P1.png is 1440x900+0+0 but:
laser-axel wrote:$ convert.exe bad_pos_P1.png -crop 500x500+100+100 test_crop.png

There is no file test_crop.png.
That is very strange. Do you get an error message? Does the problem occur with all inputs, or just this file? If just this file, then it may be corrupt.

Try:

Code: Select all

convert.exe -size 1440x900 xc: info:
convert.exe -size 1440x900 xc: -crop 500x500+100+100 info:
convert.exe -size 1440x900 xc: t1.png
convert.exe -size 1440x900 xc: -crop 500x500+100+100 t2.png
snibgo's IM pages: im.snibgo.com
laser-axel
Posts: 7
Joined: 2017-04-24T23:36:49-07:00
Authentication code: 1151

Re: no output using crop

Post by laser-axel »

bad_pos_P1.png is 1440x900+0+0 but:
Of cousre the original image is bigger. That is the purpose of cropping :D

This is happening with all images. And image magick can convert the file bad_pos_P1.png to jpg. There doesn't seem to be anything wrong with that file.
~/test
$ convert.exe -size 1440x900 xc: info:
xc: XC 1440x900 1440x900+0+0 16-bit sRGB 0.000u 0:00.030

~/test
$ convert.exe -size 1440x900 xc: -crop 500x500+100+100 info:

~/test
$ convert.exe -size 1440x900 xc: t1.png

~/test
$ convert.exe -size 1440x900 xc: -crop 500x500+100+100 t2.png

~/test
$ ls
No output is created.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: no output using crop

Post by snibgo »

So, this...

Code: Select all

$ convert.exe -size 1440x900 xc: t1.png
... didn't work either? Something is badly wrong. Sorry, I have no idea what. I suggest you re-install ImageMagick.
snibgo's IM pages: im.snibgo.com
laser-axel
Posts: 7
Joined: 2017-04-24T23:36:49-07:00
Authentication code: 1151

Re: no output using crop

Post by laser-axel »

... didn't work either? Something is badly wrong. Sorry, I have no idea what. I suggest you re-install ImageMagick.
The execution time also suggests that imagemagick is somehow crashing. Converting a big jpg to png takes 2-3 seconds. With any resize or crop the convert command immediately finishes.

I just upgraded with the cygwin installer from 6.9.5.7-1 to 6.9.5.7-2. No change in the behavior.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: no output using crop

Post by snibgo »

You are running the commands from Cygwin's bash, correct? Then try them from Windows CMD.
snibgo's IM pages: im.snibgo.com
laser-axel
Posts: 7
Joined: 2017-04-24T23:36:49-07:00
Authentication code: 1151

Re: no output using crop

Post by laser-axel »

I'm using convert from cygwins bash. Sorry, I might appera as a total noob, but I am not sure what is meant by "from Windows CMD".
convert in cygwin's bash is executing /usr/bin/convert.exe. In Windows CMD convert<RET> will execute c:\windows\system32\convert.exe, which is a conversion tool from FAT to NTFS.
Do you want me to use a windows-installation of image magick?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: no output using crop

Post by fmw42 »

Is it possible that you are trying to use the Windows convert.exe rather than the ImageMagick convert.exe?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: no output using crop

Post by snibgo »

On my Windows computer with Cygwin, I install Windows installations of ImageMagick. This works fine, running from Windows CMD or bash. I don't install IM from the Cygwin site, which you seem to have done.

I don't know why IM doesn't work for you. Sorry.
snibgo's IM pages: im.snibgo.com
laser-axel
Posts: 7
Joined: 2017-04-24T23:36:49-07:00
Authentication code: 1151

Re: no output using crop

Post by laser-axel »

Finally I have Image-Magick for Windows installed.

Following behaviour in cygwin:
$ /cygdrive/c/Programme/ImageMagick-7.0.5-Q16/convert.exe z06.png -crop 500x500+200+200 test.jpg
is working

$ convert z06.png -crop 500x500+200+200 test.jpg
does not generate any output

I think it is safe to make the statement, there is something wrong with the cygwin installation/ the cygwin-imageMagick-package.
Although I think the solution is a little odd I can fix my scripts be changing any "convert" to "/cygdrive/c/Programme/ImageMagick-7.0.5-Q16/convert.exe"
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: no output using crop

Post by fmw42 »

try adding +repage after -crop ....
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: no output using crop

Post by snibgo »

laser-axel wrote:$ convert z06.png -crop 500x500+200+200 test.jpg
does not generate any output
No output at all? Not even an error message? What happens with:

Code: Select all

convert -version
snibgo's IM pages: im.snibgo.com
laser-axel
Posts: 7
Joined: 2017-04-24T23:36:49-07:00
Authentication code: 1151

Re: no output using crop

Post by laser-axel »

Code: Select all

$ convert -version
Version: ImageMagick 6.9.5-7 Q16 x86_64 2016-12-23 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): autotrace bzlib cairo fftw fontconfig fpx freetype gslib jbig jng jp2 jpeg lcms lzma pangocairo png ps rsvg tiff webp x xml zlib
I also tried with the option "-debug All".
With the crop option this is the last entry in the debug output:

Code: Select all

2017-05-30T07:56:51+02:00 0:00.126 0.125u 6.9.5 Cache convert[2916]: cache.c/OpenPixelCache/3870/Cache
  open z06.png[0] (Heap Memory, 500x500 1.907MiB)
All the debug-output on the further actions is missing. After that nothing happens. No error message.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: no output using crop

Post by fmw42 »

try

convert z06.png -crop 500x500+200+200 +repage test.jpg

Be sure your convert is the ImageMagick convert and not the Windows convert. Also be sure your input and output images are in your working directory from which you issued the command line. Be sure you have read and write permissions for those files and the directory and execute permissions to run the command.

Be sure your install has both libjped and limping installed.

convert -list version, should list them. Or convert -list format will tell you which versions you have.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: no output using crop

Post by snibgo »

You seem to have two versions installed: 6.9.5-7 and 7.0.5-something. I don't know how to do that with Cygwin.

I suggest you remove both installations, then install just one of them.
snibgo's IM pages: im.snibgo.com
Post Reply