Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8108601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:09:53+00:00 2026-06-06T01:09:53+00:00

Scrapy framework has the built-in capability to generate thumbnails. Is there any way to

  • 0

Scrapy framework has the built-in capability to generate thumbnails. Is there any way to set a desired size for only one side in IMAGES_THUMBS to keep the original image proportion though?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:09:55+00:00Added an answer on June 6, 2026 at 1:09 am

    Had a look at Image.py in PIL module and it actually preserves the proportions automatically. The problem though that you can’t generate thumbnails of certain width or certain height – PIL will pick up either width or height depending on the original image and there’s no way to change that. Here’s the code that does the calculations.

        # preserve aspect ratio
        x, y = self.size
        if x > size[0]: y = max(y * size[0] / x, 1); x = size[0]
        if y > size[1]: x = max(x * size[1] / y, 1); y = size[1]
        size = x, y
    

    The hacky way to do that is to set a really big value for the side you don’t care about, then the other side will always be used to generate the thumbnails.
    So this does the trick for me:

     IMAGES_THUMBS = {
        'thumbs': (80, 100000),
     }
    

    Definitely not the best way, and it may stop working with the future versions of PIL but it’s good enough for now.
    Still interested in a better way to achieve the same thing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the Python Scrapy framework there is a scrapy.bat file: @echo off setlocal %~dp0..\python
By default Scrapy uses scrapy.cfg in the projects root. Is there a way to
Can't download any python Windows modules and install. I wanted to experiment with scrapy
I am working with the web scraping framework Scrapy and I am wondering how
I am really new to python, just played around with the scrapy framework that
I'm currently writing a web crawler (using the python framework scrapy ). Recently I
I am scrapping a site using scrapy framework and having trouble clicking on a
I saw this post to make scrapy crawl any site without allowed domains restriction.
Framework Scrapy - Scrapyd server. I have some problem with getting jobid value inside
I want to be able to run the Scrapy web crawling framework from within

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.