Is there a utility to create blank images?

I'm looking for an xpm icon to use as a placeholder until I make something better.

Are there any linux command line tools that create blank images of specified dimensions? Like people use touch to create blank text files.

0

3 Answers

The convert command from ImageMagick can be used:

To create a 32x32 image with a white background:

convert -size 32x32 xc:white empty.jpg

To create a 32x32 image with a transparent background:

convert -size 32x32 xc:transparent empty2.png
4

You can use convert -size 123x456 xc:white x.png. convert is part of ImageMagick.

If you do not have ImageMagick installed, you can use a short Perl script:

use GD::Simple;
my $i = GD::Simple->new(32,32);
open my $out, '>', 'empty.png' or die;
binmode $out;
print $out $i->png;

Using Python:

from PIL import Image
img = Image.new('RGB', (32,32), color='white')
img.save('empty.png')
quit()

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like