snibgo's ImageMagick pages

Announcements pertaining to ImageMagick, or ImageMagick related software. This list is moderated. No discussions here, instead post to the users group instead.
Post Reply
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

snibgo's ImageMagick pages

Post by snibgo »

I've written about 20 pages of hints, tips and techniques. Most are cookbooks of how to do various complex tasks. I've tried not to replicate the excellent works by Anthony and Fred, but inevitably there is some overlap.

The commands and scripts are Windows BAT, but should be (mostly) understandable by users of other languages.

Where are they? See my signature.
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: snibgo's ImageMagick pages

Post by fmw42 »

Great! I think the Windows community will make good use of that. No problem with overlap with my work, since mine is restricted to unix bash shell scripting and yours is windows bat file scripting.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: snibgo's ImageMagick pages

Post by snibgo »

I have added a page http://im.snibgo.com/customim.htm on customising IM with the "-process module" mechanism, to add new operations to IM in C using MagickCore. It is fairly simple, and works well.

I have written eight skeleton modules that do trivial jobs, but demonstrate the various mechanisms. And there are four modules that do something useful. I am rather pleased with mkhisto.c.

They are not yet perfect. See various cautions on the web page. In particular, I expect to change the error-handling, when I understand it.

If anything is unclear, or I have got something wrong, please let me know.
snibgo's IM pages: im.snibgo.com
MusicalSaw
Posts: 1
Joined: 2017-02-22T14:20:08-07:00
Authentication code: 1151

Re: snibgo's ImageMagick pages

Post by MusicalSaw »

I enjoyed your solutions to the four corners problem.

One other technique would be sweeping left to right and top down. The first white pixel you hit would be top left. Do the sweeps from different directions to find the other corners (eg to find the bottom right you would do a sweep right to left and bottom to top.
This would work fine for most orientations of the rectangle except when it was rotated a bit counterclockwise. But this could be detected by testing if the x-value of the bottom right corner was left of the x-value of the top left corner. If this is the case then you would have to swap the left and right corners for each other. - I think this would be the least expensive technique.

- Sorry I didn't include the IM code.
Zablaza
Posts: 2
Joined: 2018-04-27T14:56:24-07:00
Authentication code: 1152

Re: snibgo's ImageMagick pages

Post by Zablaza »

Hello snibgo, great pack of tutorials and learning material,
I was looking at the: http://im.snibgo.com/simpalign.htm - Simple alignment by matching areas
I can't seem to find the original picture you used there, also when trying to go over the example the bat file: %PICTBAT%twoBlrDiff %sa_ALI_SRC% returns the following error:
'!' is not recognized as an internal or external command,
operable program or batch file.
convert.exe: unable to open image `!BASENAME:[!BASENAME::=_!=!_2bd!EXT:[.jpg=!': Invalid argument @ error/blob.c/OpenBlob/2761.

Something is going on with the setInOut.bat, unfortunately my bat debug skills are lacking a bit.

I also noticed in http://im.snibgo.com/detail.htm that the %PICTBAT%ltBlrDiff is missing from the big zip with all the bats.

Any help with the simple alignment example is appreciated
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: snibgo's ImageMagick pages

Post by snibgo »

Thanks for your feedback.
Zablaza wrote:I can't seem to find the original picture you used there...
No. The input images are 7500x5000 pixels, 180 MB, and they would take me all day to upload. So I don't publish them. If you want to follow the process, perhaps you can use your own photos.

Zablaza wrote:the bat file: %PICTBAT%twoBlrDiff %sa_ALI_SRC% returns the following error:
'!' is not recognized as an internal or external command,
Oops. That is probably because twoBlrDiff contains the line:

Code: Select all

@setlocal
... but that line should be:

Code: Select all

@setlocal enabledelayedexpansion
(My computer automatically does "enabledelayedexpansion", so when I forget to put it in scripts, I don't get a problem.)

Zablaza wrote:I also noticed in http://im.snibgo.com/detail.htm that the %PICTBAT%ltBlrDiff is missing from the big zip with all the bats.
Oops. I'll correct that. It will probably be in the detail.htm page in about an hour, and in the zip file in about a month.

Thanks for the bug reports. Let me know of any others.


Zablaza wrote:Any help with the simple alignment example is appreciated
I often don't explain things clearly. If you can point to problem areas, I can try to help, and this will help me to explain more clearly on the web pages.
snibgo's IM pages: im.snibgo.com
Zablaza
Posts: 2
Joined: 2018-04-27T14:56:24-07:00
Authentication code: 1152

Re: snibgo's ImageMagick pages

Post by Zablaza »

I managed to make some progress without using setInOut but I am glad it is sorted and working.
I can confirm that using

Code: Select all

@setlocal enabledelayedexpansion
works.

Moving on to nLightest, I see that the files

Code: Select all

@set TMPFILE= ......
there have the .miff extension ? and %nlDEBUG_FILE% refers to a tiff file ? is this a typo ?

I started working with the exact small building photo from the page (as the POC I am doing will use mainly small 2Mpx photos)... sa_ali_coords.lis is empty.
I switched to a big panorama file (suspecting the twoBlrDiff is too rough on the small picture) ~ 15000px x 5000px, split in half and made sure the images overlap. I got the first picture through the process but still sa_ali_coords.lis is empty.

nvm I need to compile the IM with the onewhite.c module
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: snibgo's ImageMagick pages

Post by snibgo »

Zablaza wrote:nlightest.bat ... there have the .miff extension ? and %nlDEBUG_FILE% refers to a tiff file ? is this a typo ?
The temporary files are .miff. The debug file uses the same extension as the input file.

nlightest.bat needs a version of IM that includes onewhite.c. If it doesn't have onewhite, it won't work properly. (You could substitute the IM commands to do the same work, but it would be slower.)

If onewhite.c works but sa_ali_coords.lis is empty, I suggest you run nLightest.bat manually and see what happens. For example

Code: Select all

call %PICTBAT%nLightest toes.png 24[code]
The expected output is:
[code]
255,217
225,45
266,37
93,44
266,141
188,121
264,117
44,131
234,111
266,11
263,93
211,116
8,226
116,37
243,146
111,202
239,26
33,193
88,207
95,130
57,85
191,176
227,169
17,130
[code]
This means the lightest pixel is at (255,217), the second lightest (ignoring pixels close to previous pixelss) is at (225,45), etc.

Much of the processing on [url=http://im.snibgo.com/simpalign.htm]Simple alignment by matching areas[/url] is to make small-scale images for the web page, so we can see what is happening. In a production environment these are not required so the processing is simpler.
snibgo's IM pages: im.snibgo.com
Post Reply