WesleyyC / Image-Editor

A command line image editor written in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some image turned completely black after transforming by the editor

SerinaTan opened this issue · comments

test

edited-test

Example source and edited images are both attached. @WesleyyC suspected this is due to the "square" shape of the image

Oh wait a minute!!!!!! It works here!!!!!!! Looks like the image previewer is the problem!!

And the image looks kinda creepy :p

I still can't see the image on my local machine. It might still be a bug somewhere... Keeping this ticket.

Okay, a bit of investigations show that there is something going on with the image format. This image can be rendered by Chrome and Firefox but not Safari. Different browsers support different image formats. (I learned this kind of thing actually from work!!) So... once again, what format are we saving the file exactly? How come the output file format is changing dynamically?

We are saying the pic as "jpg",
ImageIO.write(im, "jpg", saveImg);
maybe try png?

@SerinaTan That's very good insight!

when change to png, the pic looks good. Will rewrite the ImageIO.write function to fit the format of the original file.

New commit solve the problem, closing the ticket.