How to create empty raster file?

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, helmut, xnview

Post Reply
sartaros
Posts: 28
Joined: Tue Dec 14, 2010 11:21 am

How to create empty raster file?

Post by sartaros »

Or create file with needed text properties, background color, format and dimensions.

i'm not found this possibility (file from nowhere) in command-line. Maybe there is no such opportunity at all?

tnx
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to create empty raster file?

Post by cday »

sartaros wrote:Or create file with needed text properties, background color, format and dimensions.
I've not found this possibility (file from nowhere) in command-line. Maybe there is no such opportunity at all?
I don't think there is a way to create a new file directly, but a workaround might be to:

o Use an arbitrary blank file as an input;

o Change the canvas colour to the colour you need using -balance;

If you start with a black empty image, it looks as if you could set the desired colour directly using the required R, G and B values.

o Resize the canvas to the required pixel dimensions using -resize or -canvas;

o Save the output to the file format and compression option you need.

But what do you mean by 'text properties' in your post?

If you mean to place text on the canvas, that should be possible using -text, but you would have to check whether that could be added in the same command line, or whether you would need to use a second command line (in a batch file if you wish).

In case you would like to experimemt, I'm attaching a small blank black file you could use as an input file.

200px_Black.png
200px_Black.png (216 Bytes) Viewed 1617 times
sartaros
Posts: 28
Joined: Tue Dec 14, 2010 11:21 am

Re: How to create empty raster file?

Post by sartaros »

Thanks
You describes the usual sequence of actions. Every action requires the launch of nconvert. i see that the result will be as declared. But i mean the single launch and without arbitrary file.
How to make this arbitrary file before future action (text, as example) in a single pass? To make a new file as if this file is input file. To request a file properties Instead of askin existing file.

Simplest input format is RAW (bit per pixel - BIP). My experimental attempt with RAW input format was unsuccessful.

nconvert.exe -in raw -out jpeg -o cc.jpg file.raw
Error: Don't know how to read this picture (file.raw)
it is a natural reaction without input file dimensions (maybe -size n m)
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to create empty raster file?

Post by cday »

sartaros wrote:Thanks
You describes the usual sequence of actions. Every action requires the launch of nconvert. I see that the result will be as declared. But I mean the single launch and without arbitrary file.
It should be possible to perform all those actions in the same command line, except possibly adding text to the canvas, I'm not sure about that without doing some tests. And if necessary you could put two or more NConvert command lines in a batch file.

There is no alternative to starting with an arbitrary file that I can see, as NConvert requires an input file to process. But the file format of the arbitrary input file shouldn't matter if the file can be opened, as the processed output can be saved to any supported format...
My experimental attempt with RAW input format was unsuccessful.

Code: Select all

nconvert.exe -in raw -out jpeg -o cc.jpg file.raw
Error: Don't know how to read this picture (file.raw)
It is a natural reaction without input file dimensions (maybe -size n m)
The input file extension needs to be one of the supported RAW formats and .raw itself isn't shown in the Help file 'Available format' list, could you check if that is the correct file extension, or possibly use one of the several RAW formats that are listed? It shouldn't be necessary to provide any details such as the dimensions of the input file.

But depending on what you actually wish to do, it should be possible to use any blank input file with a supported extension, such as the PNG attached to my first post. Could you give more details about what you wish to do, and why you used a RAW file as an input?
sartaros
Posts: 28
Joined: Tue Dec 14, 2010 11:21 am

Re: How to create empty raster file?

Post by sartaros »

The input file extension needs to be one of the supported RAW formats and .raw itself isn't shown in the Help file 'Available format' list
String #386 from file Formats.txt
[raw] Raw raw gry grey

I use the simplest format from the supported list.

OK Allow to convert my question. How to use .raw file (only bytes without header and palette) as input file in nconvert?

What are the arguments i must to set in this case
Post Reply