Skip to content
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

Convimg 9.2 crashes when provided too large image. #96

Closed
TheLastMillennial opened this issue Jan 14, 2024 · 5 comments
Closed

Convimg 9.2 crashes when provided too large image. #96

TheLastMillennial opened this issue Jan 14, 2024 · 5 comments
Assignees
Labels
mateo's fault mateo was an idiot need to do like this week. or month.

Comments

@TheLastMillennial
Copy link

Problem

If convimg 9.2 is provided an image in the palettes section that is too large, it will stop converting images early and will not produce any error. The definition of what is "too large" is unclear.

Files

Full YAML and test images: convimgIssue.zip

Yaml Purpose:

It is suppose to generate a palette from the original picture (i.e. palette-large.png).
The original picture has been split up into multiple smaller images by a separate program.
These smaller images are each turned into appvars using the palette generated from the original picture.
Finally, the palette itself is turned into an appvar.

Yaml Preview:

palettes:
  - name: my_palette
    fixed-entries:
      - color: { index: 0,   r: 0,   g: 0,   b: 0}
      - color: { index: 255, r: 255, g: 255, b: 255}
    images:
      - palette-large.png


converts:

  - name: S2000000
    palette: my_palette
    images:
      - 000000noiseTestigImageLength.png
    compress: zx0

  - name: S2001000
    palette: my_palette
    images:
      - 001000noiseTestigImageLength.png
    compress: zx0

<10 more images following the same format>


outputs:

  - type: appvar 
    name: S2000000
    source-format: ice
    header-string:  HDPICCV4noiseTes
    archived: true 
    converts: 
      - S2000000

  - type: appvar 
    name: S2001000
    source-format: ice
    header-string:  HDPICCV4noiseTes
    archived: true 
    converts: 
      - S2001000

<10 more images following the same format>

  - type: appvar
    name: HPS20000
    source-format: ice
    header-string: HDPALV10noiseTesS2003002
    archived: true
    palettes:
      - my_palette

My Attempts

Note: Later I tried using the option --log-level 4 to get debug messages however, no messages other than the ones shown in the screenshots below were displayed.

1. Large image 2800x1831 (11mb)

Line 7 of the yaml file:

  - palette-large.png

When I run convimg.exe, it stops without producing an error when attempting to read the palette.
It does not even start reading any converts . I would expect it to read all converts and generate all 13 appvars.
image

2. Medium image 840x550 (1.3mb)

I replace line 7 with

  - palette-medium.png

Convimg now successfully reads the palette.
However, it only reads 5/12 converts before stopping without error.
image

3. Small image 320x209 (212kb)

I replace line 7 with

  - palette-small.png

Note: This is within the calculator's screen resolution.
Convimg again successfully reads the palette.
However, it only reads 6/12 converts before stopping without error.
image

4. Tiny image 70x45 (9.2kb)

I replace line 7 with

  - palette-tiny.png

Note: This is extremely small and does not well represent the colors of the original image.
Convimg again successfully reads the palette.
Convimg now successfully generates all 13/13 appvars.
image

Questions

  1. Is this intended behavior? I assume no since there appears to be a specific error message for if an image is too large.
  2. What determines if an image is "too large"?

My thoughts

Convimg doesn't necessarily need to support massive 2800x1831 pictures. However, I believe it should support pictures within the calculator's screen resolution of 320x240. Reducing the picture's size to less than 0.1% of its original size is not the best solution since the smaller image colors no longer represent the original image colors very well.

@mateoconlechuga mateoconlechuga self-assigned this Jan 14, 2024
@mateoconlechuga mateoconlechuga added need to do like this week. or month. mateo's fault mateo was an idiot labels Jan 14, 2024
@mateoconlechuga
Copy link
Owner

mateoconlechuga commented Jan 14, 2024

Can you please test this: https://github.com/mateoconlechuga/convimg/actions/runs/7521533740/artifacts/1168480983

If you could provide feedback that would be nice. Looks like there are 36786 unique colors in that image, so downsampling to 256 is a little wild. Why are you using palettes for such large images?

@TheLastMillennial
Copy link
Author

Thank you, that version is working for me!

I'm still using palettes since the program was originally designed to use palettes. For this update of my picture viewing program, I decided to focus on improving the resolution of images rather than color accuracy. I felt this trade off was worth it since I've been satisfied with 256 colors for images (unless the image contains a gradient or noise). Color accuracy can be the focus of the next update!

@mateoconlechuga
Copy link
Owner

Thanks! Do the colors look right for other images too? Curious how the noisy image ends up looking

@mateoconlechuga
Copy link
Owner

I published a new version available here: https://github.com/mateoconlechuga/convimg/releases/tag/v9.3

@TheLastMillennial
Copy link
Author

Looks like you noticed the colors weren't all completely right but in v9.3 the images are indistinguishable from v9.2 which is good!
Noise (down scaled to 320x240).
v9.3
image

Here's a comparison of 8.11 then 9.2 then 9.3. I wasn't able to find any difference!
image
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mateo's fault mateo was an idiot need to do like this week. or month.
Projects
None yet
Development

No branches or pull requests

2 participants