-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
renderJpg() color is bluer than expected #3203
Comments
Hi! Thanks for reporting, it is a duplicate of #3151; could you upload an original small image that you use to generate pngs / jpgs so we can test against it? |
Thanks for the super quick follow up! |
@jdenisgiguere thanks! |
Same here. Problem here might be def renderJpg(img: MultibandTile) = {
// get a rgba tile
val coloredImg = img.color()
// begin translate from rgba to argb
val (cols, rows) = (img.cols, img.rows)
val bi = new BufferedImage(cols, rows, BufferedImage.TYPE_INT_ARGB)
cfor(0)(_ < cols, _ + 1) { x =>
cfor(0)(_ < rows, _ + 1) { y =>
val v = coloredImg.get(x, y)
val r = (v >> 24) & 0xFF
val g = (v >> 16) & 0xFF
val b = (v >> 8) & 0xFF
val a = v & 0xFF
bi.setRGB(x, y, a << 24 | r << 16 | g << 8 | b)
}
}
val result = ImageIO.write(bi, "png", new File("img.png"))
print(result)
} here i use In the end, i think it had better to make a change in the method def toBufferedImage: BufferedImage = {
val bi = new BufferedImage(self.cols, self.rows, BufferedImage.TYPE_INT_ARGB)
cfor(0)(_ < self.cols, _ + 1) { x =>
cfor(0)(_ < self.rows, _ + 1) { y =>
val v = self.get(x, y)
val r = (v >> 24) & 0xFF
val g = (v >> 16) & 0xFF
val b = (v >> 8) & 0xFF
val a = v & 0xFF
bi.setRGB(x, y, a << 24 | r << 16 | g << 8 | b)
}
}
bi
} but i cannot get a good jpg file. Might be my jvm or library goes wrong, hoping you guys make a try. |
Current situation
With I use
rendegJpg()
on a Multiband Tille, the color is not as expected. It is bluer than expected.renderPng()
return an image of the expected color.See
renderJpg()
resultand
renderPng()
resultExpected situation
repnderPng()
andrenderJpg()
should return similar image.The text was updated successfully, but these errors were encountered: