Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    J

    Jason Summers

    entropymine.com · Personal blog · on HN since 2010

    Jason Summers writes about image processing, including resampling and grayscale conversion, and makes tools like ImageWorsener and Deark.

    Visit blogHN submissions
    ProgrammingMath
    What HN says

    Commenters call ImageWorsener's pages an excellent reference on resizing and linear versus sRGB color, and some use the tool in their own projects.

    Stats for nerds
    22HN people shared it
    8linked in comments
    168story points
    Jul 2023last shared
    2010people per year2023

    Top posts on HN

    1. 1
      How web browsers resize images
      3 people · 145 points · first shared 2013 · 31 comments on HN
    2. 2
      Conversion to Grayscale (2011)
      3 people · 13 points · first shared 2019 · 7 comments on HN
    3. 3
      Deark: A utility for file format and metadata analysis and decoding
      2 people · 5 points · first shared 2021 · 1 comments on HN
    4. 4
      ImageWorsener
      6 people · 4 points · first shared 2013 · Discussion on HN
    5. 5
      Basics of Image Resampling
      3 people · 1 points · first shared 2013 · Discussion on HN
    6. 6
      Pixelmixing
      2 people · first shared 2017
    7. 7
      Bicubic
      2 people · first shared 2015
    8. 8
      Srgbformula
      1 person · first shared 2021
    9. 9
      Clamp int
      1 person · first shared 2023
    10. 10
      Subpixel
      1 person · first shared 2022

    What HN people wrote when they linked it

    • Const-meAug 2021

      These shaders are *.bin resources embedded in dwmcore.dll.

      This tool can extract https://www.nirsoft.net/utils/resources_extract.html Then, cmd_decompiler.exe from there https://github.com/bo3b/3Dmigoto can either disassemble or decompile these binaries.

      The pixel shaders there include both ps_4_0 code for new GPUs, and ps_2_0 for running on DirectX 9 GPUs. This makes the disassembler slightly more useful than the decompiler, the *.asm will contain both programs.

      They first sample from 4 locations of the source texture. The sample locations are computed by vertex shaders somehow, and passed in TEXCOORD1 and TEXCOORD2 input registers. 2D sampler needs 2 floats for UV on input, texture coordinate vectors have up to 4 components on GPUs, so they’re packing 4 2D vectors into two 4D ones, and using xy and zw slices of these vectors. Because they probably using bilinear sampling (these are setup by CPU-running code, I have not looked), these 4 sample instructions are actually reading from 16 texels of the source texture.

      Then, they compute the average of the 4 colors.

      At this stage, they’re using pre-multiplied alpha.

      For the next step of the pixel shader, they compare alpha with zero. If not zero, they convert the color to straight alpha, apply this formula https://entropymine.com/imageworsener/srgbformula/ to convert from sRGB to linear, then convert back to pre-multiplied alpha.

      For the last step, they’re applying linear transformation to the color using input values…

    • mrobApr 2022

      When you're using a ringing filter, sRGB is often a better colorspace for upscaling than linear RGB, because it distorts the ringing artifacts to make them less noticeable by putting them mostly in the highlights, not the shadows. It's not mathematically "correct", but it's better suited to human perception, similar to how minimum phase filters can perceptually outperform linear phase in audio processing, where pre-ringing is more noticeable than post-ringing.

      See "Catch #3" here:

      https://entropymine.com/imageworsener/gamma/

      And you can sometimes get even better results using a sigmoidized colorspace. See:

      https://legacy.imagemagick.org/Usage/filter/nicolas/#detailed

    • pedrocrJul 2017

      Is doing lanczos really faster and/or better quality for scaling down than just doing a simple pixel mixing:

      http://entropymine.com/imageworsener/pixelmixing/

      I implemented this for my image pipeline:

      https://github.com/pedrocr/rawloader/blob/230432a403a9febb5e5c004780211f7e765130b9/src/imageops/demosaic.rs#L155-L190

      Makes for simple enough code and even before any serious effort at optimization or SIMD it can convert a 3680x2456x4 image in 32bit float (source article is 3x8bit) to 320x200x4 also in 32bit float in about 60ms (across 4 threads in 2 cores on a i5-6200U).

    • SomeoneJun 2016

      You may want to look at http://fileformats.archiveteam.org/wiki/Category:Graphics. Collecting sample files from there is a bit of a hassle, but there's quite some obscure formats.

      On the same site, http://fileformats.archiveteam.org/wiki/Encyclopedia_of_Graphics_File_Formats points to an archive.org copy of a CD ROM with sample images.

      Via its BMP page, I found http://entropymine.com/jason/bmpsuite/, which looks like the definite resource on that format.

    • leni536Feb 2017

      Nice! I think it should be the default. Some software might treats as a compromise between correctness and cost (doing the rescaling in linear space is usually more costly). In my view it should be correctness first.

      The ImageWorsener's website as an excellent reading material on image resizing and other transformations. ImageWorsener is a "correctness first" image resizing software.

      http://entropymine.com/imageworsener/

    • planedeMar 2023

      Linear arithmetic in sRGB strikes again. Although calculating perceived brightness in a linear colorspace is also just an approximation, but it's still significantly better than doing linear arithmetic in sRGB.

      Imageworsener has a nice page about this issue in the context of converting to grayscale:

      https://entropymine.com/imageworsener/grayscale/

    Related

    Eric Brasseur4p8.com30 people

    All image-editing software gets scaling wrong

    Eric Brasseur
    Personal · last shared 2016
    Flickr Code Blogcode.flickr.net102 people

    Flickr – A Year Without a Byte

    Flickr Code Blog
    Company · last shared 2026
    Matt Taylormjt.me.uk70 people

    The smallest 256x256 single-color PNG file, and where you've seen it (2015)

    Matt Taylor
    Personal · last shared 2026
    Machine Learning Masterymachinelearningmastery.com99 people

    A Gentle Introduction to Bayes’ Theorem for Machine Learning

    Machine Learning Mastery
    Personal · last shared 2026
    Paul Harrisonlogarithmic.net26 people

    Cats and Dogs - a one dimensional theory of character

    Paul Harrison
    Personal · last shared 2025
    Kornel Lesińskikornel.ski17 people

    Speed of Rust vs. C

    Kornel Lesiński
    Personal · last shared 2024
    Max Woolfminimaxir.com85 people

    Nano Banana can be prompt engineered for nuanced AI image generation

    Max Woolf
    Personal · last shared 2026
    Kottke.orgkottke.org677 people

    The Invention of a New Pasta Shape

    Kottke.org
    Personal · last shared 2026