ImageMagick only tiles firs row - imagemagick

I am executing this command:
convert -monitor -crop 20x20# +repage +adjoin testImage.jpg image_%03d.jpg
With some JPGs it only tiles the first row and stops without any error message. However in some cases it does work properly and generates al the tiles.
This is the image to tile.
Thank you.

The solution was to manually upgrade the ImageMagick package.
In Ubuntu the apt-get command will only upgrade to v6.8.9 which still has the problem.
I had to download the latest version, compile and install it manually like the old days.
Now I am using v7.0.3 and it is cropping all the tiles. :-)
This website shows hot to do compile the latest version.
Thank you Mark Setchell for suggesting the upgrade.

Related

ghostview no longer works after homebrew upgrade of ghostscript

I recently did an update/upgrade with homebrew, and now gv no longer opens any of my .ps files. The Ghostscript error window that comes up says "Unknown device: x11 Error: PostScript interpreter failed in main window".
If I try gs --help, it doesn't list x11 under available devices, and the Default output device is "bbox". I tried uninstalling and reinstalling through homebrew. I tried to reinstall adding "--with-x11" but that throws the error "invalid option: --with-x11" - apparently that's no longer allowed. I've upgraded my command line code through the app store, and tried all of this again - nothing changed. I'm on High Sierra 10.13.3, using Homebrew 2.0.6, ghostscript 9.26_1, and gv 3.7.4.
I'm not a Mac developer so I'm not completely familiar with Homebrew, but it does sound like the package has been built wiithout X11 support. The fact that --help doesn't list the device is pretty clear.
I do notice from the website that in the last 30 days there have been 2 downloads of --with-x11. So possibly they've removed X11 support recently.
The only other thing I can suggest (assuming you are comfortable with compiling yourself) is to get the sources from www.ghostscript.com, untar the source tarball, then in a terminal window, from the 'ghostpdl' directory, execute ./autogen.sh, then when that is complete, execute 'make'.
Assuming you have autotools, gcc and the X11 development package, that should build a version of Ghostscript which includes X support. Looking at the Homebrew forumla, and assuming this has worked for you in the past, I think you should be able to build Ghostscript that way.
You might want to add --disable-cups --disable-compile-inits --disable-gtk --disablefontconfig --without-libidn to the ./autogen.sh command line to mimic the Homebrew formula. I'm not sure why they disable CUPS, but whatever.
Other than that, this isn't really a Ghostscript question as such, you would need to contact whoever handles the Homebrew Ghostscript distribution, which isn't any of the Ghostscript development team.
For those searching for a solution, I've put together a custom Homebrew tap that allows you to easily install GV (commonly called Ghostview, but really a derivative of it):
brew install johnhcc/gs-x11/gv
This will automatically install a version of Ghostscript with X11 enabled in the process (it is a dependency). You can optionally install the dependency by itself, it you want:
brew install johnhcc/gs-x11/ghostscript-x11
The main page is here:
https://github.com/johnhcc/homebrew-gs-x11

Bash: How to get size of image compressed with JPEG2000

I encoded image with jPEG2000 standard, how to get size of image after compression.
identify inputimage.pgm
works but
identify inputimage.jpc
does not work.
error is "identify: no decode delegate for this image format `J2K' # error/constitute.c/ReadImage/501."
Error messages says identify did not find necessary library to handle JPEG2000. You can check output of identify -list format to confirm that.
Indeed, it seems that JPEG2000 support is not enable in last versions of Ubuntu. Debian fixed this issue a while ago. So I suggest:
Install another distribution (Debian for exemple)
Rebuild imagemagick package with support for JPEG2000
Under Ubuntu, you can rebuild ImageMagick with JPEG2000 support following these steps:
apt-get source imagemagick
sudo apt-get build-dep imagemagick
sudo apt-get install libopenjp2-7-dev
dpkg-buildpackage -uc -us
sudo dpkg -i *deb
You can test which image formats your ImageMagick installation is able to read/write by running:
identify -list format
And further, which files ImageMagick is able to read/write by "delegating" out to a "helper program", by running:
identify -list delegate
If you are on Linux and missing JPEG2000, you will probably need to have installed the following before running ./configure to configure ImageMagick:
pkg-config
libopenjpeg
libopenjp2-7-dev
On a Mac under macOS at least, that means you need to have done:
brew install openjpeg
brew install imagemagick --with-openjpeg # Use "reinstall" if already installed
If ImageMagick does not the trick, you can try using exiftool:
exiftool -FileSize inputimage.jpc

How to tell ImageMagick's configure where to find Libpng and Zlib?

I was going through this old post Compile ImageMagick from source with PNG support on OSX.
I did mostly all of what it says with minor changes. Libpng and Zlib are in the following paths
/usr/local/libpng
/usr/local/zlib
When trying to configure ImageMagick 7.0.5-7 I do it like
./configure --prefix=/usr/local/imagemagick
CPPFLAGS='-I/usr/local/libpng/include -I/usr/local/zlib/include'
LDFLAGS='-L/usr/local/libpng/lib -L/usr/local/zlib/lib'
--enable-shared --enable-delegate-build
But still png and zlib are marked as
ZLIB --with-zlib=yes no
PNG --with-png=yes no
In some other website I read that I should add to the system variable PKG_CONFIG_PATH the path to the .pc files. So before running configure I tried also
export PKG_CONFIG_PATH=/usr/local/libpng/lib/pkgconfig:/usr/local/zlib/share/pkgconfig/
but still the libraries are not recognized.
Anyone around that knows how to tell the configure script where to look for the libraries?
I got it working !
After exploring the configure file I figured out that what was missing was pkg-config tool.
I just download it from this site installed it.
Run the command above and it works fine now.

GraphicsMagick with LIBPNG library

How should ./configure args look like in order to make install to build graphicsmagick with support of JPG conversion?
This is what I've been doing so far (which not working out):
./configure LDFLAGS="-L/Users/my_user/Downloads/libpng-1.6.10" LIBS="-libpng"
You need to install all the external libraries that you want to support before running the configure command.
At the moment, you've got only PNG support. If you want to support JPEGs, you need to install libjpeg. There are different ways to do so depending on your operating system (Mac or Linux?), or you can grab the sources and compile it yourself with the same commands (./configure, make, sudo make install).
Of course, if you want to support JPEG 2000, TIFF, etc you need to install the corresponding libraries too. See README.txt for more info and link on what libraries are needed to read what format.
I don't think you need to pass the LIBS="-libpng" to configure, GraphicsMagick should add it by default as long as it's being built with PNG support. You still need the LDFLAGS though as libpng is not "installed" and in a standard path. GraphicsMagick looks into /usr/local/lib by default so if you install the library it should be picked up without you having to do anything.
You can have a look at the text files at the root of GraphicsMagick's archive, there is a README.TXT and INSTALL-unix.txt, they might prove handy.

rails 3 paperclip imagemagick problem

I have been trying to get paperclip working for a few days now with no luck! From what I am aware this error below is related to imagemagick. I have tried to uninstall and install imagemagick both with macports and manually. Also, have Paperclip.options[:command_path] = "/usr/local/bin" set. It's starting to drive me nuts!
Photo /var/folders/A7/A7X8PAnOFsCTHkFpeODoO++++TI/-Tmp-/stream,65411,0.jpeg is not recognized by the 'identify' command.
I'm running snow leopard.
This appears when I run the rails server..
"/Users/michaelorcutt/shudder/vendor/plugins/paperclip/lib/paperclip.rb:50: warning: already initialized constant VERSION"
I've seen this problem when I was configuring ImageMagick for Rails 3 on OSX. After installing ImageMagick from mac ports and then the binary things still didn't work correctly. What finally did the trick ? finding the location of the identify binary.
which identify
put that path into your :
Paperclip.options[:command_path] =
And it should finally work.
Here is the list of things that needs to be checked for error "NotIdentifiedByImageMagickError":
Ensure that Imagemagick is installed on your system and its in the ENV path
try the command $ which identify Or $which convert.
For Ubuntu its usally in /usr/local/bin or /usr/bin.
Note the path of the above command and update the config/environments/development.rb (if
you are working in dev mode) with the following line.
Paperclip.options[:command_path]= '/usr/bin'
Incase, if you are still facing the issue check the installation of ImageMagick. If you installed from the source, the may be try packaged installation ( sudo apt-get install imagemagick)
~arunky
I currently use Paperclip, ImageMagick from macports in my Snow Leopard and havent seen that issue, are you sure that file is jpg? Try renaming it to jpg (it would be stupid, but you have to rule out everything).
Try opening several of your JPG files in a text editor, and open that one and see if the first 4 characters match (or better yet do it in a binary editor). Maybe it is a file your operating system or other software recognizes as image, but is not an actual jpg and ImageMagick is confused.

Resources