How can I make a white grid.

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?".
Post Reply
PandoraBox
Posts: 23
Joined: 2011-04-10T14:08:11-07:00
Authentication code: 8675308

How can I make a white grid.

Post by PandoraBox »

Hello Everyone,

Lets say I have my image.

*****
***** All pixels are together. 5x3 grid
*****
What I would like to do I know crop can cut to 1x1 pixels however I'm trying to figure out on how to recombine to give me
* * * * *

* * * * * Split 10x6 grid

* * * * *
Spaces besides each pixel and under them. Reason for this use is that inkscape new pixel draw function gives better results in the data information is broken down first then with inkscape I can just re-glue them together?

Right now I'm using a for loop under windows to break them into horizontal lines and then add a blank line then do the same again for the vertical one. The problem with this as you might notice if it's 1024 x 768 we're close to 2000 temp files wishing for a better solution.

Thanks again.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How can I make a white grid.

Post by snibgo »

Doing this entirely within IM uses the same technique, but we have images in a list (in memory) instead of temporary files.

Windows BAT syntax:

Code: Select all

convert ^
  in.png ^
  -background White ^
  -crop 0x1 -splice 0x1 -append -chop 0x1 ^
  -crop 1x0 -splice 1x0 +append -chop 1x0 ^
  out.png
For the background, "none" would give transparent black.

This command adds a new line between every line, and a new column between every column, so a 5x3 input will give a 9x5 output. If you want a 10x6 output, remove the two "-chop AxB" operations.
snibgo's IM pages: im.snibgo.com
PandoraBox
Posts: 23
Joined: 2011-04-10T14:08:11-07:00
Authentication code: 8675308

Re: How can I make a white grid.

Post by PandoraBox »

This is more than perfect just tried the results inside of Inkscape works like a charm and flawlessly. I seriously have to go through reading the source code for ImageMagick because really I feel ashamed of asking such questions. Thanks again well if your ever in Montreal,Qc. area I'll buy you a beer if you drink =)

PandoraBox

P.S: Saw your website love your work keep it up it's quite resourceful.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How can I make a white grid.

Post by snibgo »

Don't feel ashamed. IM is a massive system. Anyone who had memorised the contents of http://www.imagemagick.org/script/comma ... ptions.php could have answered the question. Alas, I had to cheat, and gave you a cut-down version of my blockPix.bat, which itself is an adaptation of a script by Anthony Thyssen.

But I'll happily accept a beer if I'm ever in Montreal!
snibgo's IM pages: im.snibgo.com
PandoraBox
Posts: 23
Joined: 2011-04-10T14:08:11-07:00
Authentication code: 8675308

Re: How can I make a white grid.

Post by PandoraBox »

Sorry for the late post got a power surge that knocked my whole system down, now I'm back up and running.

I'll definitely go through your batch files as I also myself am a dos freak and learn some more IM tricks from your files.

The only PITA with good old dos is that you need lots of escapes to use ImageMagick properly.

Well thanks again and glad your accepting the offer whenever it may be =)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How can I make a white grid.

Post by fmw42 »

Post Reply