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

Icons: Make PNG/XPM transparent, hi-res #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented May 22, 2024

Extend the ImageMagick convert commands for generating icon bitmaps:

  • Add -background none, to render with background transparency.
  • Add -density 300x300, to render larger sizes at full resolution.

Because the SVG's internal coordinate system is only sized for 64x64 pixels, ImageMagick will render at that size and then scale the bitmap up, when outputting larger image sizes. Increasing the DPI using -density allows it to upscale the SVG vectors at full resolution.

Comparison: 256x256 usbview.png from this branch vs. master, atop solid red

usbview-icon-compare

Extend the ImageMagick `convert` commands for generating icon bitmaps:
- Add `-background none`, to render with background transparency.
- Add `-density 300x300`, to render larger sizes at full resolution.

Because the SVG's internal coordinate system is only sized for
64x64 pixels, ImageMagick will render at that size and then scale
the _bitmap_ up, when outputting larger image sizes. Increasing
the DPI using `-density` allows it to upscale the SVG vectors at
full resolution.

Signed-off-by: FeRD (Frank Dana) <[email protected]>
@ferdnyc
Copy link
Contributor Author

ferdnyc commented May 22, 2024

(Yes, the need to specify either/both of these explicitly ranks among the more stupid and inexplicable of ImageMagick's... "endearing quirks".)

Output the icon bitmap images at standard 96 DPI, not the 300 DPI we
temporarily scaled the coordinate system to when rasterizing the SVG.

Signed-off-by: FeRD (Frank Dana) <[email protected]>
@ferdnyc
Copy link
Contributor Author

ferdnyc commented May 22, 2024

I added an additional -density flag to reset the icon bitmaps' intrinsic DPI to 96 before output, so that the 256-pixel icons don't get stored as 300 DPI 0.85 inch × 0.85 inch images. (Metadata matters!)

@ferdnyc
Copy link
Contributor Author

ferdnyc commented May 24, 2024

@gregkh Ping? I'm sure usbview is relatively low-priority, and there's certainly no real urgency to this. Just wanted to call your attention to it, if you hadn't seen. Thanks!

@gregkh
Copy link
Owner

gregkh commented May 24, 2024 via email

@ferdnyc
Copy link
Contributor Author

ferdnyc commented Jul 29, 2024

Weird... I had a new notification for this PR, but I can't for the life of me figure out why. Nothing's changed, that I can see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants