How to load png image into data base


#1

Hello all!

How I can to load image file to SciDB? I want to make some operations with them. Thank you a lot.


#2

There’s no SciDB specific way to convert .png files to SciDB arrays.

Your best bet? Write code to convert the .png to a .csv format that looks (something) like this:

image_x,image_y,r,g,b

Then you can use the standard csv -> 1D load -> redimension_store(…) -> 2D array.

Hope this helps.


#3

Here’s my $0.02’s worth.
Imagemagick suite’s “convert” command/app can make .ppm files, which are almost like a csv. Then you don’t even need to write a program, just
a simple awk or python script to make your csvs

e.g. a 640x480 (very old, old school) 24 bit image would look like this in ppm.
the first 255 is the “max” color value

P3
640 480
255
255 0 0 123 123 211 …

etc, one triplet per pixel…
run the command convert image.png image.ppm and eyeball the ppm…

George


#4

So, I make ppm-file, the image is colour. But I have some strange sequence with letters, numbers, and other characters. Is it normal? Or maybe I don’t understand you?
Or your way I can only for non colour image?


#5

Make me a small, no bigger than 32x32 ppm file.
Put it up as a

in this forum.

I’ll show you ow to make a SciDB load file from it.

Cheers, George