Colors for grayscale jpg images are wrong
- Dominant language
- Kotlin
- Stars
- 3k
- Forks
- 148
- Avg merge
- 13h 44m
- Merged PRs (30d)
- 1
Description
**LEFT** is using ImageIO.read (correct colors)
**RIGHT** is using Korge's readBitmapNative (colors are faded out, incorrect)
I managed to replicate this in jvmMain:
```
object DebugMain {
@JvmStatic
fun main(args: Array) = runBlockingNoJs {
Korge(backgroundColor = Colors["#2b2b2b"], virtualSize = Size(1280, 720)) {
val file = File("C:\\Users\\kietm\\GitHub\\ImageCropper\\src\\commonMain\\resources\\converted.jpg")
val img: BufferedImage = ImageIO.read(file)
val bmp1 = img.toAwtNativeImage()
val img1 = image(bmp1) {
scaleWhileMaintainingAspect(ScalingOption.ByWidthAndHeight(1280.0/ 2, 720.0))
}
val bmp2 = KR.converted.__file.readBitmapNative()
image(bmp2) {
scaleWhileMaintainingAspect(ScalingOption.ByWidthAndHeight(1280.0/ 2, 720.0))
alignLeftToRightOf(img1)
}
}
}
}
```
I'll go ahead and attach the grayscale JPG.

Original:

BTW here's how to create your own grayscale images using [ImageMagick](https://imagemagick.org/index.php):
```shell
$ magick.exe convert -colorspace Gray .\original.jpg converted.jpg
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the jvmMain reproduction and compare Korge's readBitmapNative output with ImageIO.read for the attached grayscale JPG. Trace the readBitmapNative path and verify the decoded colors against the reference image. Done means grayscale JPGs render with matching colors rather than appearing faded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100