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?".
User avatar
fmw42
Posts: 24474
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Icon package stylization

Post by fmw42 » 2019-01-05T14:34:00-07:00

The command is slightly different in IM 7. You need to add -channel rgb. See below:

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

magick 01.png -colorspace gray \
\( +clone -tile pencil_tile.gif -draw "color 0,0 reset" \
+clone +swap -channel rgb -compose bumpmap -composite \) \
-fx 'u*.2+v*.8' 01_sketch_bumpmap.gif

See if that works for you.

In Windows, then command would be

Code: Select all

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

magick 01.png -colorspace gray ^
( +clone -tile pencil_tile.gif -draw "color 0,0 reset" ^
+clone +swap -channel rgb -compose bumpmap -composite ) ^
-fx 'u*.2+v*.8' 01_sketch_bumpmap.gif
In Unix, the \ is a new line. In Window the ^ is the new line. Windows does not need escaping of parenthesis as in Unix.

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

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-06T02:00:09-07:00

fmw42, in last version transparency is not lost - it's very good, thank you!
But I replace a few more things: 'u*.2+v*.8' to "u*.2+v*.8"; -resize 50% to -resize 50%%; magick to convert.exe.
With these edits code runs without errors, but my result in Windows is still very far from yours result in Mac.

I don’t know what else should i fix, but at the finish I'll need to combine result with bat file for icons batch processing.
Now I tried to do it, but not very successful. I hope, based on the comments, you'll understand what I wanted to do and fix errors.
It will be great if you can check the code in Windows and finalize it. See you!

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

Re: Icon package stylization

Post by fmw42 » 2019-01-06T12:44:35-07:00

Post your exact code you are trying and your Imagemagick version.

You said earlier
I use Windows 10.1709 x64 and ImageMagick-7.0.8-15-portable-Q16-x86.
So you should use magick.exe. If you use convert.exe, you will be getting IM 6 behavior.

Did you try my Windows version of the code above? Did it give the same result as mine?

That would be

Code: Select all

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

magick.exe 01.png -colorspace gray ^
( +clone -tile pencil_tile.gif -draw "color 0,0 reset" ^
+clone +swap -channel rgb -compose bumpmap -composite ) ^
-fx 'u*.2+v*.8' 01_sketch_bumpmap.gif
When you put that in a .bat file, you need to double the % to %%

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

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-06T13:35:23-07:00

fmw42, yes, I try your Windows version of the code, but with convert.exe.
Magick.exe worked much better - the result is same as yours!!! It's amazing.
Please see what needs to be fixed in Magick_TileCreator.bat (complete with magick.exe, etc.)?

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

Re: Icon package stylization

Post by fmw42 » 2019-01-06T14:33:09-07:00

I do not understand what it is you need done further. I am not a Windows user so have limited understanding of its coding. If you need a bat file to process all your images, you will have to work that out or perhaps one of the Imagemagick users who use Windows can help you further. But you need to explain what you want done.

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

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-06T15:05:42-07:00

fmw42, I explain what I want done in Magick_TileCreator.bat.
I guess you just have to look at the rem (comments) and code between them to understand me and see where the error is.
Batch processing works (if you remove the comments - by the way, how to save comments in the code?), but the result is strange.
It's clearly visible and I have nothing to add, sorry...

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

Re: Icon package stylization

Post by fmw42 » 2019-01-06T15:26:57-07:00

Sorry, as I said above, I am not a Windows user and cannot help you with your .bat file programming.

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

Re: Icon package stylization

Post by snibgo » 2019-01-06T15:57:03-07:00

From Magick_TileCreator.bat:
Hunter23071985 wrote:magick.exe "%%~fi" ^

rem convert the colorspace to RGB for proper processing
-channel RGB ^
The "^" at the end of the line means the command is continued on the next line. The command interpreter (Windows BAT) will join all the lines together. But "rem convert the colorspace to RGB for proper processing" isn't valid inside a magick.exe command. IM doesn't know how to process "rem" etc.
snibgo's IM pages: im.snibgo.com

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

Re: Icon package stylization

Post by fmw42 » 2019-01-06T16:17:15-07:00

snibgo, I believe his bat file was actually just a file with comments about what processing he would like help to do.

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

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-07T02:47:38-07:00

fmw42 wrote:
2019-01-06T16:17:15-07:00
bat file was actually just a file with comments about what processing he would like help to do.
Yes, I added comments for you and comments can be deleted (if there is no way to save them).
I combine all commands in one line:

1. convert colorspace to RGB for proper processing
2. convert colors to gray, smoothing differences of the red, blue and green
3. convert black to gray, smoothing differences of the light and dark
4. make gray slightly more realistic
5. crop and resize the picture to 206x206 pixels
6. impose texture to a picture
7. impose picture to translucent aged paper with changing color of this paper (size 256x256)
8. save the files in sRGB color space

In my opinion, everything is logical and should work correctly.
But it seems that pictures are placed on the background of the paper and cut to the size x206 pixels.

Why is that?!

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

Re: Icon package stylization

Post by snibgo » 2019-01-07T04:27:17-07:00

When trying to understand a long command, insert operations like "+write x1.png" at suitable points. You can then look at those debugging images. For example:

Code: Select all

for %%i in (in\01.png) do %IMG7%magick.exe "%%~fi" ^
  -channel RGB ^
  -modulate 100,0 ^
  +level-colors rgb(100,100,100),rgb(170,170,170) ^
  -function polynomial 0.804,-0.00133 ^
  -evaluate max 5%% -evaluate min 90%% ^
  -fuzz 5%% -trim -thumbnail 206x206 -filter triangle ^
+write x1.png ^
  ( +clone -tile _pencil.png ^
    -draw "color 0,0 reset" ^
    +clone +swap -channel rgb -compose bumpmap -composite ^
+write x2.png ^
  ) ^
  -fx "u*.2+v*.8" ^
+write x3.png ^
  _paper.png -gravity center -compose over -composite ^
  -background RGBA(255,71,1,0.75) -flatten ^
+write x4.png ^
  -colorspace sRGB ^
  "out\%%~nxi"
Sorry, I don't know what your objective is, or what the command does that you don't want.
snibgo's IM pages: im.snibgo.com

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

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-07T04:46:23-07:00

The problem is at x4.png. Here is a test kit. Any ideas?

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

Re: Icon package stylization

Post by snibgo » 2019-01-07T05:03:41-07:00

What is wrong with x4.png? I suggest you insert another debugger:

Code: Select all

+write x3.png ^
  _paper.png -gravity center -compose over -composite ^
+write x3a.png ^
  -background RGBA(255,71,1,0.75) -flatten ^
+write x4.png ^
Is x3a what you expect/want? If not, what is wrong with it?
snibgo's IM pages: im.snibgo.com

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

Re: Icon package stylization

Post by Hunter23071985 » 2019-01-07T05:33:38-07:00

No, x3a also cropped under x206 and placed as if in the background, behind the paper.
Maybe commands -thumbnail for icon and -background for ground applied at the same time and to the icon, and to the ground.
Maybe something wrong with "_paper.png -gravity center -compose over -composite" or "-flatten".
I tried to rearrange, edit, exclude the commands - it doesn't change anything.
I don't know... It should be like this, but IM thinks differently...
Last edited by Hunter23071985 on 2019-01-07T05:54:15-07:00, edited 1 time in total.

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

Re: Icon package stylization

Post by snibgo » 2019-01-07T05:52:19-07:00

You composite _paper over x3. As _paper is partially transparent, you can see x3 "through" the paper. But you want the opposite, you want x3 composited over _paper. So insert "+swap". I think x3a is then what you want.

Code: Select all

+write x3.png ^
  _paper.png -gravity center +swap -compose over -composite ^
+write x3a.png ^
  -background RGBA(255,71,1,0.75) -flatten ^
+write x4.png ^
snibgo's IM pages: im.snibgo.com

Post Reply