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

Gallery images enlarged if they are smaller than the gallery thumbnail size #497

Closed
kjrsten opened this issue Jul 13, 2023 · 6 comments · Fixed by #788
Closed

Gallery images enlarged if they are smaller than the gallery thumbnail size #497

kjrsten opened this issue Jul 13, 2023 · 6 comments · Fixed by #788
Assignees
Labels
bug bash found bug through a bug bash bug Something isn't working help wanted Extra attention is needed

Comments

@kjrsten
Copy link

kjrsten commented Jul 13, 2023

Minor issue:

If the finished artwork is smaller than the gallery thumbnail, it is blown up to compensate, causing a blurry effect (example: pixel art avatars that are small)

Possible solution: Do not enlarge to fit if the final image is smaller than N x N pixels. Center the image instead? It might be hard to make this look good.

Aside: I don't know how to add a label to an issue in Github, clicking on labels in the right column isn't doing it.

Screen Shot 2023-07-13 at 6 39 37 PM
@rjt-rockx
Copy link
Contributor

This is a scaling issue, iirc there's different algorithms to rescale pixel art without causing fidelity loss.

https://en.wikipedia.org/wiki/Pixel-art_scaling_algorithms is worth referencing.

@zkat zkat added bug Something isn't working bug bash found bug through a bug bash labels Jul 13, 2023
@zkat
Copy link
Contributor

zkat commented Jul 13, 2023

Specifically, this is an issue with the Thumbnailer, which calls out to imagemagick. Getting a good imagemagick incantation that works in the general case is pretty hard, afaict, but I think we can make it a bit smarter than it is right now. I could definitely use some help from someone with more experience using it/processing images in general, though. That code is here:

# https://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/
Mogrify.open(tmp_src)
|> Mogrify.custom("flatten")
|> Mogrify.format(opts["format"])
|> Mogrify.limit("area", "128MB")
|> Mogrify.limit("disk", "1GB")
|> Mogrify.custom("filter", "Triangle")
|> Mogrify.custom("define", "filter:support=2")
|> Mogrify.custom("unsharp", "0.25x0.25+8+0.065")
|> Mogrify.custom("dither", "None")
|> Mogrify.custom("posterize", "136")
|> Mogrify.custom("quality", "82")
|> Mogrify.custom("define", "jpeg:fancy-upsampling=off")
|> Mogrify.custom("define", "png:compression-filter=5")
|> Mogrify.custom("define", "png:compression-level=9")
|> Mogrify.custom("define", "png:compression-strategy=1")
|> Mogrify.custom("define", "png:exclude-chunk=all")
|> Mogrify.custom("interlace", "none")
|> Mogrify.custom("colorspace", "sRGB")
|> Mogrify.custom("strip")
|> then(fn mog ->
if opts["target_size"] do
mog
|> Mogrify.custom("define", "#{opts["format"]}:extent=#{opts["target_size"]}")
else
mog
end
end)
|> then(fn mog ->
if opts["dimensions"] do
mog
|> Mogrify.gravity("Center")
|> Mogrify.custom("thumbnail", opts["dimensions"])
|> Mogrify.custom("extent", opts["dimensions"])
else
mog
end
end)
|> Mogrify.save(path: tmp_dest)

@zkat
Copy link
Contributor

zkat commented Jul 16, 2023

Moving this post-MVP/beta because while it's definitely an issue, I don't think it warrants blocking beta release.

@zkat zkat changed the title Gallery images enlarged if they are smaller than the gallery thumbnail size label:bugbash #bugbash #minor Gallery images enlarged if they are smaller than the gallery thumbnail size Aug 19, 2023
@zkat zkat moved this to 📋 Backlog in Banchan Project Roadmap Aug 19, 2023
@zkat
Copy link
Contributor

zkat commented Sep 24, 2023

This might "magically" be fixed by #610, so I'm moving it to this sprint just to see if that's all that's needed.

@zkat zkat self-assigned this Sep 24, 2023
@zkat zkat linked a pull request Feb 17, 2024 that will close this issue
@zkat zkat removed a link to a pull request Feb 17, 2024
@zkat zkat moved this from 📋 Backlog to 🏗 In progress in Banchan Project Roadmap Feb 17, 2024
@zkat
Copy link
Contributor

zkat commented Feb 18, 2024

This is partially fixed as of #784, but now we need to go through the site and make sure that:

  1. We don't upscale images when we display them
  2. Places that were used to upscaled images don't break (like cards, which are definitely broken now).

Moving this back to the backlog and reassigning, since this is now frontend work.

@zkat zkat moved this from 🏗 In progress to 📋 Backlog in Banchan Project Roadmap Feb 18, 2024
@zkat zkat assigned rjt-rockx and unassigned zkat Feb 18, 2024
@zkat zkat moved this from 📋 Backlog to 🏗 In progress in Banchan Project Roadmap Feb 20, 2024
@zkat zkat linked a pull request Mar 25, 2024 that will close this issue
28 tasks
@zkat
Copy link
Contributor

zkat commented Mar 25, 2024

This is fixed in #788, along with the larger portfolio redesign.

@zkat zkat assigned zkat and unassigned rjt-rockx Mar 25, 2024
@zkat zkat closed this as completed in #788 Mar 31, 2024
@zkat zkat closed this as completed in 932aa06 Mar 31, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Banchan Project Roadmap Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bash found bug through a bug bash bug Something isn't working help wanted Extra attention is needed
Projects
Status: ✅ Done
Status: Backlog
Development

Successfully merging a pull request may close this issue.

3 participants