i have a question to work with pictures in Codenameone (my Code works,I just want to ask if there is a better way)
(don't really know how to call the title because it's really specific)
at the end i want to get a 24Bit non compressed image (so i picked PNG)
- i have an Image(Image1 JPG) selected by the user that i scale down/up dynamicaly(with the normal scale method)
- i crate a copy of the image with EncodedImage.create(width,height) so its mutable --> Image2
- i draw Image1 on Image2
- i set Image1 to null (don't need it anymore)
- i draw an watermark on Image2 (needs to be drawn before step 6)
- i get pixels = Image2.getRGBCached() because i modify a lot of pixel values
- i set Image2 to null
- i modify the pixel values
- i call EncodedImage.create(pixels,width,height) --> Image3 (if i save Image3 it's 32Bit PNG)
- i create a copy of image 3 with EncodedImage.create(width,height) --> image4
- i draw Image3 on Image4
- save Image4 --> output = 24Bit PNG
maybe can i open an Image that is directly mutable or save image 3 as 24 Bit PNG directly?
Thanks
Marcus