
Fred's ImageMagick Scripts - primogen
http://www.fmwconcepts.com/imagemagick/index.php
======
contingencies
Seeing tools like this pop up periodically and get so many upvotes it seems a
lot of people aren't aware of great tools. It would be interesting to see a
gallery of Unix classic/modern tools presented in a structured course. Is
anyone aware of one?

Something like images (imagemagick), video (ffmpeg/vlc), audio (sox), phone
(asterisk/etc.), SMS (pdus/various), linguistics (various), classification
(NNs), version control, snapshots, clustering (PXE/corosync/pacemaker),
security (kernel toolkits), transaction systems and databases
(sqlite/RDBMS/noSQL/time series), networking (filtering/firewall rules,
intermittent connectivity, local multidrop protocols, tcpdump/wireshark),
kernel security toolkits, CI/CD, etc.

Scope would be essentially everything except tools lying within the popular
web stacks.

The goal would be that a student with interest could work their way through
the syllabus and emerge a capable multi-domain unix hacker, rather than
needing to encounter these problem domains over decades of career,
rediscovering well worn approaches.

~~~
jypepin
YES THIS PLEASE.

I learned programming through the web, so I lack a lot of knowledge in basic
systems / bash / *nix / I'm not even sure how to call that.

I've googled so many time "learn bash" etc but it's never really what I'm
looking for.

I regularly discover tools that are so basic yet so powerful (all things you
mention) yet I feel there is a lack of (great) resources online to "learn the
basic tools of your CL".

~~~
crowbahr
You mean you don't just go read the man page for every bash command and
intuitively understand it?

Sorry for the sarcasm, I just feel your pain. Learning even basic things in
bash has been slow for me too. I love it. I prefer it to GUIs on most things I
have figured out.

But there's so much to learn.

~~~
jypepin
from a sibling comment:
[http://www.tldp.org/LDP/abs/html/](http://www.tldp.org/LDP/abs/html/) seems
to be great :)

~~~
moviuro
It isn't as good as:
[https://mywiki.wooledge.org/BashGuide](https://mywiki.wooledge.org/BashGuide)
(which is the one that gets recommended on #bash @ freenode). Also:
[https://shellcheck.net](https://shellcheck.net)

------
orf
The whiteboard script is particularly interesting:
[http://www.fmwconcepts.com/imagemagick/whiteboard/index.php](http://www.fmwconcepts.com/imagemagick/whiteboard/index.php)

~~~
tincholio
I can't seem to find the link now, but there was a post here a couple of weeks
back about someone doing a very similar thing (in Python, IIRC) to clean up
pictures of handwritten notes. It seemed conceptually simple, and worked quite
nicely.

~~~
timvdalen
I know the one you mean, this classic one was linked from it:
[https://mzucker.github.io/2016/09/20/noteshrink.html](https://mzucker.github.io/2016/09/20/noteshrink.html)

~~~
discussedbefore
[https://news.ycombinator.com/item?id=16567275](https://news.ycombinator.com/item?id=16567275)

------
jfaucett
Oh man this page brings back some golden memories! I remember working with
ImageMagick for the first time in 2010 or 2011 when I wrote a bash script to
programmatically scale and center thousands of images for creating image
gallery thumbnails on an internal social platform for winners of a design
award. I somehow landed on this page and used the massive amounts of knowledge
to learn how the ImageMagick scripting interface worked. Then it was a fairly
simple task to build the script, but - like all bash scripts for me - I've
forgotten every single parameter now :)

Somehow that feels much longer ago than just 7 years, maybe its just the
website or the feeling of nostalgia looking at it.

------
boramalper
fisheye2rect is just mind-blowing

[http://www.fmwconcepts.com/imagemagick/fisheye2rect/index.ph...](http://www.fmwconcepts.com/imagemagick/fisheye2rect/index.php)

I guess I never really understood why fisheye lenses were so valuable, until
now. =)

~~~
gnarbarian
Yes it is. I've been using that script to create 360 photos which can be fed
into Google's web vr view. [0]

[0] [https://faa-aviation-data-
portal.github.io/routeDemo/camera/...](https://faa-aviation-data-
portal.github.io/routeDemo/camera/cube.html)

~~~
jumelles
This is really cool, can you explain more how you did this? :)

~~~
gnarbarian
I don't have the script on hand at the moment. But essentially I take two 180
degree fisheye photos one pointing straight up and one pointing straight down.
(for this, I used a homebrew cardboard box and two mobotix cameras)

I then use OP's script to "unroll" each fisheye photo. I then stick them
together top to bottom with looks like this:

[https://faa-aviation-data-portal.github.io/routeDemo/camera/...](https://faa-
aviation-data-portal.github.io/routeDemo/camera/fused.jpg)

Which I feed into this:

[https://github.com/googlevr/vrview](https://github.com/googlevr/vrview)

voila

took a couple hours start to finish.

------
symisc_devel
For those interested we implemented from scratch a subset of these commands as
a REST API service available to call at request from any programming language.

[https://pixlab.io/cmdls](https://pixlab.io/cmdls)

~~~
bhldr
This is a bit far from what most would consider REST. Just call it a HTTP api?

Looks cool though! I would love a product that behaves like a proxy/CDN for
images and does some on-demand resizing/filtering.

~~~
jjeaff
There is no true REST API. Just like there is no true Scottsman.

~~~
bhldr
I don't disagree with you, but this one in particular seems very far from the
definition even if you ignore all the hypermedia stuff.

------
jinpan
It would be interesting to augment an image recognition dataset with
additional inputs generated by minor transformations under these scripts.

~~~
steve_musk
This is fairly standard practice (although I don’t know if ImageMagick is
specifically used).

------
jonzlin
Interesting to see this re-surface on Hacker News. This set of scripts has to
be among the most useful things I've found on the internet, and I've used some
of these in many of my projects!

------
hawktheslayer
These are great and I need to start using these. For instance the
dominantcolor script extracts color schemes from pictures. Something I've
tried to do by eye in the past with limited success.

[http://www.fmwconcepts.com/imagemagick/dominantcolor/index.p...](http://www.fmwconcepts.com/imagemagick/dominantcolor/index.php)

------
extralego
There is some very powerful stuff in here. I wonder if the author has
implemented these in any DCC plugins?

------
thanatos519
That awk Mandelbrot script is pretty hardcore.

------
anon1253
If ImageMagic isn't your thing and like a GUI but don't like Photoshop or the
GIMP I really recommend PixInsight
([http://www.pixinsight.com/](http://www.pixinsight.com/)). It's normally used
for astronomical image processing but it's well build with some advanced stuff
in there. Unfortunately not free, but people have to pay the bills!

------
tomaskafka
No no no, we can't have this, that's too old fashioned!

Proper way to do this is to create an image processing SaaS around these
scripts, announce to store the filter presets on blockchain and create a
marketplace platform for filter creators, have a $50M ICO, spend the cash on
lambos, and fail awesomely.

EDIT: Ok, I just didn't scroll far enough :)
[https://news.ycombinator.com/item?id=16668686](https://news.ycombinator.com/item?id=16668686)

~~~
gitgud
It constantly amazes me how huge the variation is between some software
services and the reward for their effort.

On the one hand you have giant startups earning millions from a tiny SaaS
tool.

And on the other hand you have a single developer sharing a huge library of
useful tools for free.

It's a crazy world now, it seems opportunity is everywhere.

------
stanislavb
Old and gold

------
otterpro
It's listed alphabetically and difficult to know what each script does. I had
to click each one to find out what it does, but these are my favorites:

* tshirt- Transforms an image to place it in a region of a tshirt image

* tileimage - Tiles an image to a given size with various tile arrangements.

* shadows - Applies drop shadows to an image.

* grid - Superimposes a set of horizontal and/or vertical grid lines on an image.

* lupe - Applies a magnifying glass effect in a local area of an image.

* multicrop - Crops and unrotates multiple images from a scanned image.

* peelingpaint - Applies a peeling paint effect to an image.

* picframe - Adds a picture frame around an image.

* picturefold - Applies a map-like folded appearance to an image.

* PINBARREL - Corrects or applies pincushion and/or barrel lens distortion to an image.

* PUZZLE - Applies a puzzle like effect to an image.

* RANDOMCLIPART - Randomly distributes clip art over the image.

* SKETCH - Applies a sketch effect to an image. SMARTCROP - Automatically crops an image to a given size around the hightest detail region.

* TILER - Converts an image into a tilable texture.

* UNPERSPECTIVE - Automatically removes pespective distortion from an image.

* UNROTATE - Automatically unrotates a rotated image and trims the surrounding border.

* VINTAGE1 - Applies a a classic vintage effect to an image

* DIAGCOLLAGE - Collages three images in a diagonal orientation.

* DEFISHEYE - Corrects for fisheye distortion in an image.

* EMBROIDERY - Applies an embroidery effect to each color in an image.

* DOMINANTCOLOR - Computes the dominant color in an image.

* OVERLAPCROP - Creates a sequence of cropped subsections permitting optional overlap of the subsections.

* TRIMMER - Trims the background from any number of specified sides of an image.

* outfit - use texture image onto image of clothing

* splitcrop - split one image into many pieces

* whiteboard - Processes a picture of a whiteboard to clean up the background and correct the perspective

* postagestamp - convert image into stamp

* glow - add glow effect

~~~
danieltillett
There is a summary page of what all the scripts do [0].

0\.
[http://www.fmwconcepts.com/imagemagick/script_list.txt](http://www.fmwconcepts.com/imagemagick/script_list.txt)

------
fwgwgwgch
I love ImageMagick but I can't believe there's only one feel facto cli image
processing tool. Do people know of others?

~~~
yread
I use VIPS

[https://jcupitt.github.io/libvips/API/current/using-
cli.html](https://jcupitt.github.io/libvips/API/current/using-cli.html)

Much better performance and better image format support for my use.

It also has a gui

[https://github.com/jcupitt/nip2](https://github.com/jcupitt/nip2)

~~~
networked
The GitHub wiki for VIPS has a page [1] very relevant to GP's question. It
lists two dozen alternatives to VIPS (both command line tools and libraries)
and compares how they performed on a load-crop-scale-apply convolution-save
task. The source code for each implementation of the task is right there on
the page.

[1] [https://github.com/jcupitt/libvips/wiki/Speed-and-memory-
use](https://github.com/jcupitt/libvips/wiki/Speed-and-memory-use)

~~~
fwgwgwgch
Thanks!

------
bringtheaction
Cool collection of effects. Too bad they are free for non-commercial use only.

~~~
tyingq
That seems a little sketchy for the simpler ones, like this:
[http://www.fmwconcepts.com/imagemagick/gaussian/index.php](http://www.fmwconcepts.com/imagemagick/gaussian/index.php)

He shows the equivalent IM command lines, and it's 2 lines of text.

No issue with the more complex ones though...it's his work.

~~~
ams6110
He also documented (with example images) and web-published all of them. It's
not just two lines of code.

~~~
kup0
So if I do this in ImageMagick on a commerical project:

    
    
      convert $infile \( $infile -blur 0x$width \) -compose minus +swap \ -composite -normalize $tmp0
      composite -blend $mix%x100% $tmp0 $infile -matte $outfile
    

I now owe Fred something?

So everyone that ever figures out how to do something neat with a free tool
and documents it gets to claim the rights to that and ask for money?

Might not even be against this as an idea, but the premise seems shaky to me,
I guess

Maybe more to the point is- if you want to ask for money for doing work like
this, don't publish the ImageMagick command equivalents? Though I guess that
would be hard to avoid other than putting it in some proprietary UI/app or
something. Oh well.

~~~
fiddlerwoaroof
No, if you save time reading imagemagick documentation by grabbing an off-the-
shelf script, you owe him something

