Git Product home page Git Product logo

Comments (4)

sherwinski avatar sherwinski commented on September 25, 2024 1

@ashutoshkrris Yes exactly, that is the correct output.

from imgix-python.

ashutoshkrris avatar ashutoshkrris commented on September 25, 2024

Hi @sherwinski
Is my below understanding correct?

Example 1:

from imgix import UrlBuilder
client = UrlBuilder("demo.imgix.net")
client.create_srcset("image.jpg", {"w": 100}, {"device_pixel_ratios": [1, 2]})

Output:

https://demo.imgix.net/image.jpg?dpr=1&q=75&w=100 1x
https://demo.imgix.net/image.jpg?dpr=2&q=50&w=100 2x

Example 2:

from imgix import UrlBuilder
client = UrlBuilder("demo.imgix.net")
client.create_srcset("image.jpg", {"w": 100}, {"device_pixel_ratios": [1, 4]})

Output:

https://demo.imgix.net/image.jpg?dpr=1&q=75&w=100 1x
https://demo.imgix.net/image.jpg?dpr=4&q=23&w=100 4x

Example 3:

from imgix import UrlBuilder
client = UrlBuilder("demo.imgix.net")
client.create_srcset("image.jpg", {"w": 100}, {"device_pixel_ratios": [1, 2, 3]})

Output:

https://demo.imgix.net/image.jpg?dpr=1&q=75&w=100 1x
https://demo.imgix.net/image.jpg?dpr=2&q=50&w=100 2x
https://demo.imgix.net/image.jpg?dpr=3&q=35&w=100 3x

If the above examples are fine, I am interested to work on this issue.

from imgix-python.

sherwinski avatar sherwinski commented on September 25, 2024

Hey @ashutoshkrris,

You've got it right with the examples you've provided. The only one I would add is a way for users to modify variable qualities with their specified ratios:

Example:

from imgix import UrlBuilder
client = UrlBuilder("demo.imgix.net")
client.create_srcset(
  "image.jpg",
  { "w": 100 },
  {
    "device_pixel_ratios": [ 1, 2, 3 ],
    "variable_qualities": { 1: 45, 2: 30, 3: 20 }
  }
)

Output:

https://demo.imgix.net/image.jpg?dpr=1&q=45&w=100 1x
https://demo.imgix.net/image.jpg?dpr=2&q=30&w=100 2x,
https://demo.imgix.net/image.jpg?dpr=3&q=20&w=100 3x,

I'll go ahead and assign this issue to you. Please let me know if you have any other questions.

from imgix-python.

ashutoshkrris avatar ashutoshkrris commented on September 25, 2024

Thanks for the clarity @sherwinski
Just one more case, what should be the output in this case?

from imgix import UrlBuilder
client = UrlBuilder("demo.imgix.net")
client.create_srcset(
  "image.jpg",
  { "w": 100 },
  {
    "device_pixel_ratios": [ 1, 3 ],
    "variable_qualities": { 1: 45, 2: 30, 3: 20 }
  }
)

Should this be the output?

https://testing.imgix.net/image.jpg?ixlib=js-3.7.0&w=100&dpr=1&q=45 1x,
https://testing.imgix.net/image.jpg?ixlib=js-3.7.0&w=100&dpr=3&q=20 3x

from imgix-python.

Related Issues (14)

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.