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

bug: gvar_extended text missing from preview.png #90

Closed
errolt opened this issue Jan 26, 2022 · 13 comments
Closed

bug: gvar_extended text missing from preview.png #90

errolt opened this issue Jan 26, 2022 · 13 comments
Labels
bug Something isn't working

Comments

@errolt
Copy link

errolt commented Jan 26, 2022

It looks like, after the move to the new image lib, the text went missing from the preview.png image.
Looking at the code, the text is drawn on uninitialized image objects.
I don't know if the old image lib automatically expanded the image, but the new image lib checks that the pixels are within image bounds, and exists if not.

Images for text overlay created here:
https://github.com/altillimity/SatDump/blob/093bba360ceb3b6de65062f87ce6a7993929c872/plugins/gvar_extended/main.cpp#L122

Text written to overlay images here:
https://github.com/altillimity/SatDump/blob/093bba360ceb3b6de65062f87ce6a7993929c872/plugins/gvar_extended/main.cpp#L136-L138

draw_text uses draw_pixel which does bounds checking here:
https://github.com/altillimity/SatDump/blob/093bba360ceb3b6de65062f87ce6a7993929c872/src-core/common/image/image_drawing.cpp#L14-L15

The result is images that are still empty, even after the text was "drawn".

Either the draw_text function should expand the image, or the images must be created large enough to fix the text.

@ZbychuButItWasTaken
Copy link
Collaborator

That's very possible. Gonna be honest here: I haven't properly tested it as my station was down so I didn't have any recent data. It indeed doesn't init the images before writing. That's an easy fix though, so gonna work on it in a free moment.

@ZbychuButItWasTaken ZbychuButItWasTaken added the bug Something isn't working label Jan 26, 2022
@errolt
Copy link
Author

errolt commented Jan 26, 2022

I did try an easy fix by initing all the images to (bar_height,previewImage.width()) but that had unexpected results, as the code that prints these images onto the final image expected the overlay images to only be as wide as the text in them, so one would have to init the images to the size of the text.

@ZbychuButItWasTaken
Copy link
Collaborator

Yeah, that was the easiest way to do it in CImg. I'll change up the code a bit and it will work just fine

@errolt
Copy link
Author

errolt commented Jan 26, 2022

BTW, no rush. I only got plugins running last night, so this isn't disrupting or urgent. Just thought I'd file a bug for it...

@ZbychuButItWasTaken
Copy link
Collaborator

Alright! and thanks for letting me know, I wouldn't have seen it myself until I put my station back up which is gonna be in a few days...

@ZbychuButItWasTaken
Copy link
Collaborator

Update:
I've been tinkering with it for a while and it's almost ready! I've ended up modifying the image lib, but the current font doesn't work very well in low resolution. I'll try some other fonts, but the basic mechanism works

preview

@errolt
Copy link
Author

errolt commented Jan 27, 2022

Great! Thanks. I also saw the weird aliasing. I'll take a look at the font scaling tonight, see if I can improve it.

@ZbychuButItWasTaken
Copy link
Collaborator

well, it's using bilinear resizing for it. This font just doesn't look very good when resized.. Roboto mono will do better here, it's a lot "thicker"

@ZbychuButItWasTaken
Copy link
Collaborator

(the font system, like the whole image lib is still very basic, so some things aren't done "properly" yet)

@ZbychuButItWasTaken
Copy link
Collaborator

Just pushed a closing fix, it all works now.
preview

@errolt
Copy link
Author

errolt commented Jan 28, 2022

Nice! Thanks!

@ZbychuButItWasTaken
Copy link
Collaborator

let me know if it all works well for you though

@errolt
Copy link
Author

errolt commented Jan 29, 2022

Works great! thanks!
G13_ALL_20211214T154518Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants