GithubHelp home page GithubHelp logo

img-ideal's Introduction

img-ideal

Tool for finding images being served at the wrong size.

Usage

$ ./img-ideal.js --help
img-ideal.js <url>

Check URL for any images displayed too large/small

Positionals:
  url  URL to check images on                                         [required]

Options:
      --help            Show help                                      [boolean]
      --version         Show version number                            [boolean]
  -v, --verbose         Run with verbose logging      [boolean] [default: false]
      --maxShrinkRatio                                 [number] [default: "0.8"]
      --maxGrowRatio                                     [number] [default: 1.2]

Example

./img-ideal.js https://www.bbc.co.uk/news

Inspecting page: 414 x 1000 (scale factor: 1)
Src: https://ichef.bbci.co.uk/news/240/cpsprodpb/A3C9/production/_114892914_mediaitem114887391.jpg (Displayed: 183 x 103 (1x), Image: 240 x 135). Ratio: 0.58
Src: https://ichef.bbci.co.uk/news/240/cpsprodpb/14292/production/_114887528_mediaitem114887526.jpg (Displayed: 183 x 103 (1x), Image: 240 x 135). Ratio: 0.58
Src: https://ichef.bbci.co.uk/news/240/cpsprodpb/D4B1/production/_114894445_braodimage.png (Displayed: 183 x 103 (1x), Image: 240 x 135). Ratio: 0.58
Src: https://ichef.bbci.co.uk/news/240/cpsprodpb/CC94/production/_111527325_index_daily_update_version02_cv_976new.png (Displayed: 183 x 103 (1x), Image: 240 x 135). Ratio: 0.58
Src: https://ichef.bbci.co.uk/news/240/cpsprodpb/2A4D/production/_114892801_ronaldoportugalindex.jpg (Displayed: 183 x 103 (1x), Image: 240 x 135). Ratio: 0.58

This shows that on a device with a 414px wide screen and no pixel scale factor 5 images are being served too large.

The ratio is defined as pixelsDisplayedByDevice / pixelsInSourceImage so images with ratios below 1 are being served too large, above 1 are being upscaled in browser.

img-ideal's People

Contributors

stuartloxton avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.