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 5992507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:32:29+00:00 2026-05-22T23:32:29+00:00

I have been looking around and would like to know what everyone uses to

  • 0

I have been looking around and would like to know what everyone uses to resize images in case I am missing out.

I am using php imageGD library imagejpeg() ect.

I have continually updated my class to try and “Solve” this one situation:

If an image a user uploads is say 469×358 and the display end picture needs to be or is designed to fit within a 120×80 box for instance. If i resize based upon width the resulting resized image will be 120×92, i could just then fix the height but that will pixelate or squash the image, i could also crop the end off with either imageGD or css overflow hidden.

I have had a quick look and seen that there are algorithms(bicubic ect) that you can use to shrink an image which sharpens it so it doesnt look squashed, which is the continual effect i seem to get with imageGD. Has anyone used this algorithm?

I have also seen ImageMagick has anyone used this software? Does it shrink an image better?

I am currently cropping the end off with overflow hidden, but is there a better way?

  • 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-05-22T23:32:30+00:00Added an answer on May 22, 2026 at 11:32 pm

    If an image a user uploads is say
    469×358 and the display end picture
    needs to be or is designed to fit
    within a 120×80 box for instance. If i
    resize based upon width the resulting
    resized image will be 120×92, i could
    just then fix the height but that will
    pixelate or squash the image, i could
    also crop the end off with either
    imageGD or css overflow hidden.

    If your image was 358×469 (portrait) and you want to resize it to 120×80 so that the image does not look distorted, here is the math:

    358/469 = width/80 => width = 358*80/469 = 61px (approx)
    

    We had a taller image we’ll use maximum height and constrained width. A desired width of 120px means the image is stretched horizontally; with a better algorithm you can only achieve smoothness but you cannot make a squashed/stretched image look normal with a better algorithm.

    If fitting is required, I suggest that you crop-to-fit of resize-to-fit. You can do this on the server side via GD library/ImageMagick or on the client side using CSS background positioning. If you’re using GD, cropping is as simple as resizing the image with negative offsets (somewhat similar to CSS background positioning with negative background-position).

    Edit 1

    If it is a question of whether to use GD or IM, I’d suggest IM. I am not sure about the quality of output but as far as performance is concerned, IM will outperform GD, specially when you are dealing with high resolution images. In case you prefer GD, the GD library function imagecopyresampled will give you better results compared to imagecopyresized but higher CPU and/or memory usage.

    Edit 2

    I forgot to mention, I stopped using GD long time ago and switched to phpThumb. Takes care of most of the chores. Internally it uses GD and/or IM — built-in intelligence lets it select the best available method for a given operation.

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

Sidebar

Related Questions

I have been looking around for a visualization framework that would aid graph visualization
I have been looking into android development for some time and would really like
I have been looking around for solutions, and tried to implement what is often
I have been looking around ocn Google and Stackoverflow but haven't found what I
I have been looking around on the web and found some articles about the
I have been looking around and even found a couple of related answers and
I have been looking around the web for this but cannot really find a
I have been looking around for awhile now and I can't seem to find
Hey i have been looking around and i cant find a way to get
Alright so I have been looking around (on SO and Google) to see if

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.