TASImage in batch mode

Hi,
I’m using the TASImage library to read an image file and fill the actual pixel information into an array using getPixels(…). This works fine when not running root in batch mode. As soon as I operate root in batch mode I can read the correct dimension of the image but calling getPixels(…) leads to an array full of zeros. Is there a possibility to extract the pixel information of an image in batch mode? Currently I’m using root v5.12.00.

Thanks for your help!
Markus

Hi Markus,
TImage::GetPixels method returns an array of 32bit values.
Each value corresponds to some color presented in hardware/display-specific format.
Batch mode “assumes” that no display exists.
So, TImage::GetPixels is meaningless in batch mode.

You can use TImage/TASImage::GetArgbArray method
root.cern.ch/root/htmldoc/TASIma … tArgbArray
to extract the color information of an image.

Each element of array is in ARGB format:
A - 8bit apha value (aka transparency). It can be ignored.
R - 8bit red color value
G - 8bit green color value
B - 8bit blue color value

You can directly manipulate with these values and the correspondent image will
be changed accordinglly.

Regards. Valeriy