Passing many draw points from the command line
Passing many draw points from the command line
Hello
I would like to generate a 256x256 .png file in which I can discretely set the colour of each pixel in the image. Is there a way to pass in these tens of thousands of -draw points from the command line, without having to call the command line once for each and every pixel I want to draw? I imagine this would have to involve a text file containing the values to be written, otherwise the shell might reach its character limit or something.
Thanks
I would like to generate a 256x256 .png file in which I can discretely set the colour of each pixel in the image. Is there a way to pass in these tens of thousands of -draw points from the command line, without having to call the command line once for each and every pixel I want to draw? I imagine this would have to involve a text file containing the values to be written, otherwise the shell might reach its character limit or something.
Thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Passing many draw points from the command line
See txt: at https://www.imagemagick.org/Usage/files/#txt or sparse-color: at https://www.imagemagick.org/Usage/files/#sparse-color. Create a text file in one of these formats and use that as input to convert.
convert @textfile.txt result.png
convert @textfile.txt result.png
Re: Passing many draw points from the command line
It's quite easy to use
Code: Select all
convert -background black txt:input.txt -filter point -resize 64x64! output.png
Result:input.txt wrote: # ImageMagick pixel enumeration: 2,2,255,rgb
0,0: (255,255,255)
1,0: (0,0,0)
0,1: (0,0,0)
1,1: (255,255,255)
Re: Passing many draw points from the command line
Hello again
So it turns out I need to generate multiple image files, and it seems some antivirus software doesn't like it when I call convert.exe multiple times in succession, where it will block some of the instances of convert.exe and in some cases freeze my calling application as well.
Is it possible to get around this issue by sending multiple input text files to convert.exe in one command line argument, so that I only have to run convert.exe once to generate all my image files?
eg. something like
It seems like the answer is no based on:
Thanks
So it turns out I need to generate multiple image files, and it seems some antivirus software doesn't like it when I call convert.exe multiple times in succession, where it will block some of the instances of convert.exe and in some cases freeze my calling application as well.
Is it possible to get around this issue by sending multiple input text files to convert.exe in one command line argument, so that I only have to run convert.exe once to generate all my image files?
eg. something like
Code: Select all
convert txt:input1.txt output1.png , txt:input2.txt output2.png , txt:input3.txt output3.png ... etc.
But I just need to make sure before I spend the next few weeks rewriting that entire section of my program to avoid the issue with antivirus programs.https://www.imagemagick.org/script/command-line-processing.php#anatomy wrote: The ImageMagick command-line consists of
one or more required input filenames.
zero or one output image filenames
Thanks
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Passing many draw points from the command line
There are a couple common methods to read in multiple image files, modify them in particular ways, then output the results as several files. These examples should help you get started...pneumatic wrote: ↑2018-04-10T03:55:29-07:00Is it possible to get around this issue by sending multiple input text files to convert.exe in one command line argument, so that I only have to run convert.exe once to generate all my image files?
Code: Select all
convert txt:input1.txt output1.png , txt:input2.txt output2.png , txt:input3.txt output3.png ... etc.
Code: Select all
convert txt:input1.txt txt:input2.txt txt:input3.txt -resize 64x64! output%03d.png
Code: Select all
convert txt:input1.txt -resize 64x64! -write first.png +delete txt:input2.txt -resize 48x48! -write second.png +delete ...
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Passing many draw points from the command line
I recommend just using +write.
Also you can use +write for the last image if you replace the final +delete with null:
Also you can use +write for the last image if you replace the final +delete with null:
Re: Passing many draw points from the command line
Brilliant, thank you.