Add pixel-perfect scaling mode for image preview#163
Conversation
Introduce a pixel-perfect scaling option for large image preview so pixel art can be viewed without blur from smooth interpolation or arbitrary zoom ratios. This adds a persisted toggle, applies nearest-neighbor rendering in the large image view, snaps zoom-in behavior to integer multiples of 100% when the mode is enabled, and prefers integer-multiple fit-to-window sizes where possible. The mode is exposed from the large-image menu and refreshes open viewers immediately when changed. This keeps existing behavior for cases where the image must be displayed below 100%, since true pixel-perfect presentation is not possible while downscaling.
|
Thank you very much for your work! That’s a great idea! However, in terms of the actual implementation, it might be worth trying a different approach. I noticed that the code uses An alternative approach could be to modify Unfortunately, I don’t have much free time right now; I’m just pointing out these issues for your reference! |
|
@netdcy is this more in line with your requirements?? |
Replace the pixel-perfect large-image path that depended on overriding NSImageView.draw(_:) with an image preprocessing approach. - remove the CustomLargeImageView draw override and rely on normal view rendering - add a nearest-neighbor upscale path in ImageProcess for pixel-perfect enlargement - allow safe >100% pixel-perfect upscales for smaller images while keeping original-image fallback for large/high-risk cases - include pixel-perfect upscale parameters in the large-image cache key to avoid collisions This avoids the legacy draw-path behavior called out in review feedback while preserving protection against oversized GPU/buffer usage.
a454517 to
806d58c
Compare
Introduce a pixel-perfect scaling option for large image preview so pixel art can be viewed without blur from smooth interpolation or arbitrary zoom ratios.
This adds a persisted toggle, applies nearest-neighbor rendering in the large image view, snaps zoom-in behavior to integer multiples of 100% when the mode is enabled, and prefers integer-multiple fit-to-window sizes where possible. The mode is exposed from the large-image menu and refreshes open viewers immediately when changed.
This keeps existing behavior for cases where the image must be displayed below 100%, since true pixel-perfect presentation is not possible while downscaling.
Current:
with "Pixel Perfect Scaling"