Icon package stylization

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Hunter23071985
Posts: 22
Joined: 2019-01-03T12:48:14-07:00
Authentication code: 1152

Icon package stylization

Post by Hunter23071985 » 2019-01-03T14:55:10-07:00

Hi!

The command for batch processing of PNG files in the IN-folder with saving to the OUT-folder in Windows (bat-file):

Code: Select all

cd /d "%~dp0" 
for %%i in (in\*.png) do convert.exe -channel RGB -modulate 100,0 +level-colors rgb(100,100,100),rgb(170,170,170) -fuzz 5%% -trim -filter triangle -thumbnail 206x206 -extent 256x256 -gravity center -function polynomial 0.804,-0.00133 -evaluate max 5%% -evaluate min 90%% -background RGBA(255,71,1,0.75) -flatten -colorspace sRGB "%%~fi" "out\%%~nxi"
At the entrance: a variety of colors and shades, sizes and forms, faded and bright, all mixed up.
At the exit: uniform quiet color scale without sharp differences; identical size, form and overall design.
Viewing: before - after (different background to divide software and add colors). The source is here.

The goal: remove the pure black, lighten the dark, darken the light, i.e. bring everything to a "common denominator."
In general, the goal is achieved. A gray icon on a semitransparent background doesn't hurt the eyes, but looks a little faded...
Alas, on this stage my imagination and knowledge of IM have ended...

Now I'd like to round the edges and smooth resize-artifacts. How to do it and what can be changed / improved in general?

snibgo
Posts: 11796
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Icon package stylization

Post by snibgo » 2019-01-03T16:13:28-07:00

What version of IM? On Windows, I assume.
Hunter23071985 wrote:... what can be changed / improved in general?
Rearrange the convert command to be in the logical order: read the file, process it, then write it.
Hunter23071985 wrote:Now I'd like to round the edges and smooth resize-artifacts.
I'm unsure what you want. Sample images would help.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 25117
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Icon package stylization

Post by fmw42 » 2019-01-03T16:24:27-07:00


Hunter23071985
Posts: 22
Joined: 2019-01-03T12:48:14-07:00
Authentication code: 1152

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-04T03:44:57-07:00

snibgo, I use Windows 10.1709 x64 and ImageMagick-7.0.8-15-portable-Q16-x86.
This topic was created because I'm sure that there are many creative people on this forum.
ImageMagick has many functions, but I found this program a couple days ago.
I saw links offered by fmw42 and many others too, but not all of them I can understand and use.
That's why I hope that someone offers something cool!

Now sample design for me: iOS style icons (transparent rounded corners + overlay some sheen).
Maybe it would be interesting to convert icons into a pencil drawing or something else.
I converted 01.png into a "pencil sketch" 02.png and then combined it with 2 backgrounds, getting 03.png and 04.png.
You can download it here. I think it looks good.
Could you rebuild the convert command and add this features to it?

Hunter23071985
Posts: 22
Joined: 2019-01-03T12:48:14-07:00
Authentication code: 1152

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-04T09:11:48-07:00

Post updated. Hope for your help!

User avatar
fmw42
Posts: 25117
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Icon package stylization

Post by fmw42 » 2019-01-04T11:12:38-07:00

I do not understand what you want. Are you asking to reproduce the pencil sketch. If so, Imagemagick does not have such a function that works the same way, though you might be able to make something similar by combining other commands. See https://imagemagick.org/Usage/transform/#sketch

try

Code: Select all

convert 01.png -colorspace gray -emboss 0x1.2 01_pencil.png
Once you have that you can simply overlay it on your background images.

Code: Select all

convert "_ Background1.png" 01_pencil.png -gravity center -compose over -composite result.png
I suggest you not use image names with spaces in them.


If this is not what you want, please explain in more detail and/or show examples of what you want.

Hunter23071985
Posts: 22
Joined: 2019-01-03T12:48:14-07:00
Authentication code: 1152

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-04T12:21:43-07:00

fmw42, thank you for combining icon and background - this is exactly what i wanted.
Remains to work out a pencil sketch - "emboss" looks bad, something else like "Pencil Sketch" I cannot set up correctly...
Is it possible to achieve a good result?

User avatar
fmw42
Posts: 25117
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Icon package stylization

Post by fmw42 » 2019-01-04T12:34:55-07:00

You should be able to simply replace your image for the one in Anthony's Pencil Sketch. Nevertheless, here it is along with the composite I showed you before.

Code: Select all

convert -size 256x256 xc:  +noise Random  -virtual-pixel tile \
-motion-blur 0x20+135 -charcoal 1 -resize 50% pencil_tile.gif

convert 01.png -colorspace gray \
\( +clone -tile pencil_tile.gif -draw "color 0,0 reset" \
+clone +swap -compose color_dodge -composite \) \
-fx 'u*.2+v*.8' 01_sketch.gif

convert "_ Background1.png" 01_sketch.gif -gravity center -compose over -composite result.png

Hunter23071985
Posts: 22
Joined: 2019-01-03T12:48:14-07:00
Authentication code: 1152

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-04T12:58:32-07:00

fmw42, such result I already received - the whole icon with transparent part becomes a "sketch". It cannot be fixed?
And what is "Anthony's Pencil Sketch"?

User avatar
fmw42
Posts: 25117
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Icon package stylization

Post by fmw42 » 2019-01-04T13:18:27-07:00

Sorry, I do not understand what you want fixed. Please give more details.

Anthony's pencil sketch is the link you provided above "Pencil Sketch"

Hunter23071985
Posts: 22
Joined: 2019-01-03T12:48:14-07:00
Authentication code: 1152

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-04T13:36:15-07:00

fmw42, see the results comparison...

User avatar
fmw42
Posts: 25117
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Icon package stylization

Post by fmw42 » 2019-01-04T17:14:50-07:00

Try this

Code: Select all

convert -size 256x256 xc:  +noise Random  -virtual-pixel tile \
-motion-blur 0x20+135 -charcoal 1 -resize 50% pencil_tile.gif

convert 01.png -resize 500x500 -colorspace gray \
\( +clone -tile pencil_tile.gif -draw "color 0,0 reset" \
+clone +swap -compose hardlight -composite \) \
-fx 'u*.2+v*.8' 01_sketch1.gif

convert "_ Background1.png" 01_sketch1.gif -gravity center -compose over -composite result1.png
or

Code: Select all

convert -size 256x256 xc:  +noise Random  -virtual-pixel tile \
-motion-blur 0x20+135 -charcoal 1 -resize 50% pencil_tile.gif

convert 01.png -resize 500x500 -colorspace gray \
\( +clone -tile pencil_tile.gif -draw "color 0,0 reset" \
+clone +swap -compose bumpmap -composite \) \
-fx 'u*.2+v*.8' 01_sketch2.gif

convert "_ Background1.png" 01_sketch2.gif -gravity center -compose over -composite result2.png
You can substitute other -compose methods other than hardlight and bumpmap and see if you can find anything better. Let us know. See

https://imagemagick.org/Usage/compose/#math
https://imagemagick.org/Usage/compose/#light

Hunter23071985
Posts: 22
Joined: 2019-01-03T12:48:14-07:00
Authentication code: 1152

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-05T01:17:55-07:00

Is there an error in the second variant? Here's what I got...
I suppose this method should help, but it is too complicated for me...

User avatar
fmw42
Posts: 25117
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Icon package stylization

Post by fmw42 » 2019-01-05T11:02:21-07:00

The second variant for me produces something else. What is your IM version and data and platform? I am using IM 6.9.10.23 Q16 Mac OSX

Result1:
Image


Result2:
Image


I do not see what background subtraction has to do with your problem or example.

Hunter23071985
Posts: 22
Joined: 2019-01-03T12:48:14-07:00
Authentication code: 1152

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-05T13:09:19-07:00

Looks good! But I use Windows 10.1709 x64 and ImageMagick-7.0.8-15-portable-Q16-x86.
You have seen the result. I'ill try IM 6.9.10.23 and will report the results little later.
If not difficult, remove the pictures from your post. Thank you!

Post Reply