imwrite is not working

Andy Chee chinsta00 at hotmail.com
Mon Jan 19 19:37:18 CST 2009



Andy Chee wrote:
> 
> 
> Saswata Mandal wrote:
>> 
>> Bug report for Octave 3.0.3 configured for i686-pc-msdosmsvc
>> 
>> Description:
>> -----------
>> 
>> x = imread('image.png');
>> imwrite('abc.png',x); --> fails with following message
>> 
>> warning: warn_empty_list_elements is no longer a built-in variable;
>> please
>> read
>> the NEWS file or type `news' for details
>> warning: is_list is obsolete and will be removed from a future version of
>> Octave
>> ; please use islist instead
>> error: transpose not defined for N-d objects
>> error: evaluating postfix operator `'' near line 273, column 10
>> error: evaluating assignment expression near line 273, column 8
>> error: evaluating if command near line 272, column 1
>> warning: warn_empty_list_elements is no longer a built-in variable;
>> please
>> read
>> the NEWS file or type `news' for details
>> error: called from `imwrite' in file `C:\Program Files
>> (x86)\Octave\share\octave
>> \packages\image-1.0.8\imwrite.m'
>> 
> 
> I am having the same problem with the same result on my system running
> Octave 3.0.3 under Linux
> 
> The commands I used to create the error which are basically the same,
> were:
> 
> im = imread('original.jpg');
> imwrite('copy.jpg',im);
> 
> Note however if original.jpg is a greyscale image these commands work as
> I'd expect
> 

I suppose one way of working around it would be to split 'into R,G,B and
then write it back.  So the commands would be:

im = imread('original.jpg');
im_red = im(:,:,1);
im_green = im(:,:,2);
im_blue = im(:,:,3);
imwrite('copy.jpg', im_red, im_green, im_blue);

Or you could combine them in one line:

im = imread('original.jpg');
imwrite('copy.jpg', im(:,:,1), im(:,:,2), im(:,:,3));

But does this really address the problem with imwrite?

-- 
View this message in context: http://www.nabble.com/imwrite-is-not-working-tp21178851p21555441.html
Sent from the Octave - Bugs mailing list archive at Nabble.com.



More information about the Bug-octave mailing list