How automate crops of an image - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions) +--- Thread: How automate crops of an image (/Thread-How-automate-crops-of-an-image) Pages:
1
2
|
RE: How automate crops of an image - rich2005 - 08-12-2020 Not Gimp using ImageMagick Quote:I need to take different segmented crops of an image. Say my image is 100 tall by 2000 wide (100x2000 pixels) quick-n-dirty bash script with fixed values, change as appropriate. wide.png is the 2000x100 image. Code: #!/bin/bash RE: How automate crops of an image - stevem0 - 08-12-2020 Thank You RE: How automate crops of an image - stevem0 - 08-13-2020 (08-12-2020, 06:24 PM)rich2005 Wrote: Not Gimp using ImageMagick Thanks? I am not sure, lol. I have not messed with bash chmod linux terminal commands in 10 yrs? And then, it was just messing. (and vi, I mean are we still using that? Luckily a little clue ":q") I came here for a little help and I think I am getting tortured lol. Maybe I will just manually rectangle select and paste each one in gimp haha, no. please have mercy. I have been trying to figure this out, as all my barriers are stupid questions but I am getting wore out. So I believe I have everything running correctly, I can run "magick wide.png win:" and it opens up in the image in image viewer I am a long ways from getting the script to work, the wide.png is in working directory When I enter this line: $ convert wide.png -crop 750x100+$i+0 +repage "%02d"$i.png it gives me the error: Invalid Parameter - -crop RE: How automate crops of an image - Ofnuts - 08-13-2020 (08-13-2020, 04:08 AM)stevem0 Wrote: I am a long ways from getting the script to work, the wide.png is in working directory What ImageMagick version? IIRC -crop is a recent addition. RE: How automate crops of an image - rich2005 - 08-13-2020 ImageMagick (IM) command line in a terminal still widely used. Quote:..I can run "magick wide.png win: If that works then you are using IM version 7 Is this in linux or Windows ? Obvously bash for linux, you need an equivalent bat file for Win. I am really rusty with Windows batch when it comes to loops. For IM 7 exchange magick for convert (convert is also a Windows command that plagues Windows users) Quote:When I enter this line: The i of course comes from the loop. Not there so you get an error. The syntax is magick image -crop WIDTHxHEIGHT+XOFFSET+YOFFSET +repage croppedimage Your single command, for the first image $ convert wide.png -crop 750x100+0+0 +repage "%02d"0.png edit: for Windows thatshould be $ magick wide.png -crop 750x100+0+0 +repage 0.png (how to leading zeros in windows ??? - do not know) The "%02d" pads out the name with leading zeros. I assume your set of 125 (or so) images are destined for an animation (or similar) and need regular numbering. Tried and I know it works. How are you getting on with ofnuts plugin? @ Ofnuts crop , recent, I do not think so http://www.imagemagick.org/Usage/crop/ RE: How automate crops of an image - stevem0 - 08-13-2020 (08-13-2020, 06:49 AM)Ofnuts Wrote:(08-13-2020, 04:08 AM)stevem0 Wrote: I am a long ways from getting the script to work, the wide.png is in working directory Version: ImageMagick 7.0.10-25 Q16 x64 2020-08-01 (08-13-2020, 07:04 AM)rich2005 Wrote: ImageMagick (IM) command line in a terminal still widely used.I am using cygwin, I believe that is a "linux" emulation terminal for windows. I installed the imageMagick version ImageMagick-i686-pc-cygwin.tar.gz for cygwin. I downloaded that file within cygwin (wget) tar and installed in the cygwin environment. $ magick -version Version: ImageMagick 7.0.10-25 Q16 x64 2020-08-01 http://www.imagemagick.org Copyright: Copyright © 1999-2018 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Visual C++: 192628806 Features: Cipher DPC HDRI Modules OpenCL OpenMP(2.0) Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib RE: How automate crops of an image - rich2005 - 08-13-2020 Of course for Windows you can download an installation file from the IM website. I have been looking at a Windows .bat and a bit stuck on adding some leading zeros to (easily) make the images with consecutive numbers. Not impossible to get around without but tedious when loading images. For linux and IM7 it looks like this: https://youtu.be/k0LiyMPh_gM 1 minute 20 seconds worth Hopefully you will get a Gimp script / plugin working and not require IM. RE: How automate crops of an image - stevem0 - 08-13-2020 (08-13-2020, 12:46 PM)rich2005 Wrote: Of course for Windows you can download an installation file from the IM website. That was very helpful. I was just about to post ,but it looks like all I needed to add to the script was: magick convert wide.png -crop 750x100+$i+0 +repage "%02d"$i.png >LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$MAGICK_HOME/lib $export LD_LIBRARY_PATH I can see the instructions to download and install the delegates. |