GUI for Geometry
GUI for Geometry
Hi guys,
I was wondering, are there any Windows GUI plugins for ImageMagick? What I mean is, for instance, I would like to write a small batch script that preforms a few actions on a set of pictures in a folder. One of the things I need to do is crop all the pictures in that folder in a certain way. Basically, these pictures are photos of biological cells taken under microscope for research. So, one folder would contain 6-10 photos of the same cell but under different fluorescent lights. Because the area to be cropped out is different for every sat of images, currently I have to figure out the geometry by hand every time before running the script.
It would be cool if I can instead write a script like so:
IMHelper convert folder\*.jpg -crop ++geometry++ folder\out-*.jpg
IMHelper would be an interpreting program, it would run through the script supplied to it, when it encounters ++geometry++ it would popup a preview window with first picture from the source, and let me select the cropping area. Then it would pass those values to imagemagic. I searched and searched, and could not find anything like this. If it already exists, could someone point me in the right direction. And if not, maybe someone wants to write it I would my self, but I would not know were to begin with real programming
I can also see such as "IMHelper" having other GUI functions, such as ++source-files-drop++ would show a dropbox into which one could drag files, or ++out-files++ would show a save as dialogue. All kinds of interactive plugins basically can be added to interact with im scripts.
Any ideas or suggestions for my specific problems? Any comments on the idea presented above?
Thanks in advance for any help!
- Bogdan
I was wondering, are there any Windows GUI plugins for ImageMagick? What I mean is, for instance, I would like to write a small batch script that preforms a few actions on a set of pictures in a folder. One of the things I need to do is crop all the pictures in that folder in a certain way. Basically, these pictures are photos of biological cells taken under microscope for research. So, one folder would contain 6-10 photos of the same cell but under different fluorescent lights. Because the area to be cropped out is different for every sat of images, currently I have to figure out the geometry by hand every time before running the script.
It would be cool if I can instead write a script like so:
IMHelper convert folder\*.jpg -crop ++geometry++ folder\out-*.jpg
IMHelper would be an interpreting program, it would run through the script supplied to it, when it encounters ++geometry++ it would popup a preview window with first picture from the source, and let me select the cropping area. Then it would pass those values to imagemagic. I searched and searched, and could not find anything like this. If it already exists, could someone point me in the right direction. And if not, maybe someone wants to write it I would my self, but I would not know were to begin with real programming
I can also see such as "IMHelper" having other GUI functions, such as ++source-files-drop++ would show a dropbox into which one could drag files, or ++out-files++ would show a save as dialogue. All kinds of interactive plugins basically can be added to interact with im scripts.
Any ideas or suggestions for my specific problems? Any comments on the idea presented above?
Thanks in advance for any help!
- Bogdan
Re: GUI for Geometry
There have been a couple of attempts at Windows GUI but they seem to have disapeared.
You can check this thread: viewtopic.php?f=1&t=18219&hilit=gui
I belive the OP was looking for some testers but it has to be on windows 64bit
You can check this thread: viewtopic.php?f=1&t=18219&hilit=gui
I belive the OP was looking for some testers but it has to be on windows 64bit
- whugemann
- Posts: 289
- Joined: 2011-03-28T07:11:31-07:00
- Authentication code: 8675308
- Location: Münster, Germany 52°N,7.6°E
Re: GUI for Geometry
You can use IrfanView as a geometry GUI for ImageMagick. You can do that by way of an AutoHotKey script that performs some action based on your selection in IrfanView. (BTW: IrfanView can of course do a batch crop by itself.) Here is an AHK-Script that marks the selected area in the original photo and extracts that area from the photograph. I provide it as-is (with German comments). I will incorporate this example on my Windows Usage page in the future (see link below).
Code: Select all
; ***********************************
; IRFANVIEW
; Windows + m:
; Das Script stellt einen Fotoausschnitt verlustlos frei
; und markiert den freigestellten Bereich im Originalfoto
;
; Benötigte Programme:
; IrfanView, ImageMagick, JPEGtran (http://jpegclub.org/jpegtran)
;
; Version 1.0 -- 2012-07-18
; ***********************************
IS = 928x928 ; Größe des Verkleinerten Bildes
DEN = 157x157 ; Density in dpi
CROP = _mag1 ; Namensanhängsel des Ausschnitts
EXT = _mag2 ; Namensanhängsel der Daeti mit Markierung
IMCONV = imconv.exe ; Names des Convert-Befehls
JPEGTran = jpegtran.exe ; Name des JPEGtran-Programms
#IfWinActive, ahk_class IrfanView
#m:: ; Hotkey = Windows + m
WinGetActiveTitle, Title ; make sure something is selected
IfNotInString, Title, Selection
{
MsgBox,48,Fehler,Bitte erst einen Bereich auswählen.
Return
}
; Den Dateinamen aus der Titelleiste extrahieren
; und den Namen der Ausgabedatei daraus ableiten.
; Dabei prüfen, ob der Pfadname eine Laufwerksangabe enthält(Doppelpunkt).
StringGetPos, Pos, Title,-, R
StringLeft InFilename, Title, Pos - 1
IFNotInString, InFileName,:
{
MsgBox,48,Fehler,Bitte IrfanView so einstellen, dass der vollen Dateipfad in der Titelleiste angegeben wird.
Return
}
StringReplace OutFilename, InFileName, ., %EXT%.
StringReplace CropFileName, InFileName, ., %CROP%.
InfileName := """" . Infilename . """"
OutfileName := """" . Outfilename . """"
CropFileName := """" . CropFileName . """"
;
; Den Auswahbereich in Breite, Höhe und Offsets zerlegen
; Nach dem Semikolon
Pos := Instr(Title, "Selection")
StringGetPos, Pos2, Title,;, R
Selection := SubStr(Title, Pos + 10, Pos2 - Pos - 9)
Blank := " "
StringReplace Masse, Selection,%Blank%,, All ; Leerzeichen löschen
Pos := Instr(Masse, ",")
StringLeft x, Masse, Pos - 1
Pos2 := InStr(Masse, ";")
StringMid y, Masse, Pos + 1, Pos2 - Pos - 1
StringMid wh, Masse, Pos2 + 1
Pos:=Instr(wh, "x")
StringLeft w, wh, Pos - 1
StringMid h, wh, Pos + 1
;
; Hier wird die IM Befehlszeile zusammengesetzt
; Die Eingabedatei wird in den Speicher geschrieben (mpr = memory program register)
x2 := x + w
y2 := y + h
strCmd = %imconv% %InFileName% -write mpr:org -fill none -stroke yellow -strokewidth 5 -draw
strCmd = %strCmd% "rectangle %x%,%y% %x2%,%y2%"
strCmd = %strCmd% -resize %IS% -density %den% -quality 80`% %OutFileName%
Run %strCmd%
;
; JPEGtran-Befehl
;strCmd = %jpegtran% -crop %w%x%h%+%x%+%y% %InFileName% %CropFileName%
density := 157 * w / 928
border := floor(8 * w / 928)
strCmd = %imconv% %InFileName% -crop %w%x%h%+%x%+%y% -bordercolor red -border %border% -density %density% %CropFileName%
Run %strCMD%
return
Wolfgang Hugemann
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: GUI for Geometry
http://www.vips.ecs.soton.ac.uk/index.p ... operations
http://libvips.blogspot.ca/2011/06/usin ... -nip2.html
http://libvips.blogspot.ca/2011/04/nip2 ... agick.html
nip2 runs fine from Windows (I'm told: not a windows user).
http://libvips.blogspot.ca/2011/06/usin ... -nip2.html
http://libvips.blogspot.ca/2011/04/nip2 ... agick.html
nip2 runs fine from Windows (I'm told: not a windows user).
On Windows and OS X, nip2 includes its own copy of ImageMagick, so there are no other packages to install.
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: GUI for Geometry
I don't know if this works from Windows, but you could use display http://www.imagemagick.org/Usage/basics/#display http://www.imagemagick.org/www/display.html to immediately show the result of your IM operation, on the same command line.
So, it would not be a GUI, but you could tweak the crop value on the command line, press return, see the result, kill the display (in unix, <CTRL>-C would do it from the command line), "up arrow" to recall the last command line, and edit to taste for another go.
With a bit of practice, almost certainly faster than using a GUI, because you'd do everything from the shell (DOS terminal, I imagine), without every moving your hands from the keyboard.
(From MinGW? Cygwin? I don't really know: sheltered *n*x snob here.)
So, it would not be a GUI, but you could tweak the crop value on the command line, press return, see the result, kill the display (in unix, <CTRL>-C would do it from the command line), "up arrow" to recall the last command line, and edit to taste for another go.
With a bit of practice, almost certainly faster than using a GUI, because you'd do everything from the shell (DOS terminal, I imagine), without every moving your hands from the keyboard.
(From MinGW? Cygwin? I don't really know: sheltered *n*x snob here.)
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: GUI for Geometry
Something like
should work very well (UNIX, or Cgiwin), but I don't know of any.
I myself use "xv" with a 'info' window to select regions. But I have to manually type the geometry result
For points I use display with its magnifier, mostly to get 'colors' for remapping.
Something like this built into IM would be useful with IMv7 "magick" scripting.
Also a 'multi-point picker' with magnification for exact pixel/color selection, perhaps even sub-pixel positioning would also complement things.
Problem the "display" program under windows is also in need of a developer. Or so I believe, as I am not a Windows user.
Code: Select all
convert image.jpg -crop `im_geometry image.jpeg` result.png
I myself use "xv" with a 'info' window to select regions. But I have to manually type the geometry result
For points I use display with its magnifier, mostly to get 'colors' for remapping.
Something like this built into IM would be useful with IMv7 "magick" scripting.
Also a 'multi-point picker' with magnification for exact pixel/color selection, perhaps even sub-pixel positioning would also complement things.
Problem the "display" program under windows is also in need of a developer. Or so I believe, as I am not a Windows user.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: GUI for Geometry
Gimp can be used as a GUI driver for IM, rather clumsily. True, I'd like Gimp to build a batch file of IM commands that I could run at my leisure, but doing that is probably harder than making Gimp 16-bit. In the meantime, we can:
1. Use Gimp curves tool to adjust tones, colour balance etc. Then use Gimp to apply the same curve to a gradient file that IM can use for CLUT. This is easy and real magic -- I can easily see the effect of subtle changes to the curve in Gimp, leaving IM to do the 16-bit work.
2. Use Gimp to decide on a crop and save it. Then IM can work out the cropping parameters and apply that to a 16-bit file. This is actually a tricky problem for IM. We can use "compare -metric RMSE -subimage-search", but this takes too long for 36M pixel files. The trick is to make tenth-size copies (-resize 10%) of the original and the crop. IM can quickly find this crop within this image, so now we know the position within about 10 pixels for the full-size image and crop. This lets us narrow the search for the full-size crop within the full-size image, so that is also fast.
1. Use Gimp curves tool to adjust tones, colour balance etc. Then use Gimp to apply the same curve to a gradient file that IM can use for CLUT. This is easy and real magic -- I can easily see the effect of subtle changes to the curve in Gimp, leaving IM to do the 16-bit work.
2. Use Gimp to decide on a crop and save it. Then IM can work out the cropping parameters and apply that to a 16-bit file. This is actually a tricky problem for IM. We can use "compare -metric RMSE -subimage-search", but this takes too long for 36M pixel files. The trick is to make tenth-size copies (-resize 10%) of the original and the crop. IM can quickly find this crop within this image, so now we know the position within about 10 pixels for the full-size image and crop. This lets us narrow the search for the full-size crop within the full-size image, so that is also fast.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: GUI for Geometry
You can also do compount color processing in GIMP on an HALD image. Create the unprocessed HALD image in IM, process it in GIMP, then bring the modified HALD image back to IM and use it to apply to many images. Note the HALD technique does not work with spatially dependent processing such as convolution, blur, sharpen or resize/distort. see http://www.imagemagick.org/Usage/color_mods/#hald-clutsnibgo wrote:Gimp can be used as a GUI driver for IM, rather clumsily. True, I'd like Gimp to build a batch file of IM commands that I could run at my leisure, but doing that is probably harder than making Gimp 16-bit. In the meantime, we can:
1. Use Gimp curves tool to adjust tones, colour balance etc. Then use Gimp to apply the same curve to a gradient file that IM can use for CLUT. This is easy and real magic -- I can easily see the effect of subtle changes to the curve in Gimp, leaving IM to do the 16-bit work.
This is the exact trick I use in some of my scripts to speed up the subimage search with compare.snibgo wrote:2. Use Gimp to decide on a crop and save it. Then IM can work out the cropping parameters and apply that to a 16-bit file. This is actually a tricky problem for IM. We can use "compare -metric RMSE -subimage-search", but this takes too long for 36M pixel files. The trick is to make tenth-size copies (-resize 10%) of the original and the crop. IM can quickly find this crop within this image, so now we know the position within about 10 pixels for the full-size image and crop. This lets us narrow the search for the full-size crop within the full-size image, so that is also fast.
Fred
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: GUI for Geometry
Ah, great minds ... In theory, the tenth-size trick might generate a false positive, but it works for me.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: GUI for Geometry
Agreed!snibgo wrote:Ah, great minds ... In theory, the tenth-size trick might generate a false positive, but it works for me.
In principal, one could do it on a factor of 2 pyramid. I thought about that, but decided it was too much work.