Open GoogleCodeExporter opened 9 years ago
You use version 2.0 of the library, but version 2.0 does
not contain 'image_to_j2k' but 'opj_compress'.
opj_compress -i infile.EXT -o outfile.EXT
or
image_to_j2k -i infile.EXT -o outfile.EXT
Both test the outfile extension: JP2, J2k, etc
and decide whether the outfile should be done.
Both test the infile extension: PNG, BMP, etc
and decide which conversion function should be called:
pngtoimage, bmptoimage, etc.
The pipe stream does not contain an extension that
can be tested.
One could perhaps add a special input file name, e.g.
'-i pipe:PNG' or '-i pipe:png'
to call pngtoimage.
winfried
Original comment by szukw...@arcor.de
on 13 Jul 2013 at 7:41
cat file7.png | bin/opj_compress -i pipe:png -o file7.j2k
[INFO] tile number 1 / 1
Generated outfile file7.j2k
---------------
CHANGES
---------------
convert.c:
===============
pngtoimage(const char *read_idf, opj_cparameters_t * params)
{
int piped = 0;
if(strcmp(read_idf, "pipe:png") == 0)
{
reader = stdin; piped = 1;
}
else
if((reader = fopen(read_idf, "rb")) == NULL)
{
fprintf(stderr,"pngtoimage: can not open %s\n",read_idf);
return NULL;
}
}
opj_compress.c:
===============
static int get_file_format(char *filename)
{
char *ext = strrchr(filename, '.');
if (ext == NULL)
ext = strrchr(filename, ':');
if(ext == NULL) return -1;
++ext;
}
winfried
Original comment by szukw...@arcor.de
on 13 Jul 2013 at 8:41
In the above sketch add at the very end of pngtoimage():
if(!piped) fclose(reader);
winfried
Original comment by szukw...@arcor.de
on 14 Jul 2013 at 5:38
Original comment by mathieu.malaterre
on 24 Feb 2014 at 5:25
Issue 379 has been merged into this issue.
Original comment by m.darb...@gmail.com
on 23 Oct 2014 at 9:34
Renamed to add opj_decompress & writing over stdout
Original comment by m.darb...@gmail.com
on 23 Oct 2014 at 9:36
The absence of file extension can easily be overcome by using magic numbers.
They are much more reliable than file extensions anyways.
Original comment by njdo...@gmail.com
on 23 Oct 2014 at 10:03
Original issue reported on code.google.com by
rado.mar...@gmail.com
on 8 Jun 2013 at 3:35