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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:26:10+00:00 2026-05-23T21:26:10+00:00

$tmp_im = imagecreatetruecolor($width, $height); $x = $this->getX(); $y = $this->getY(); $w = floor($resize_height *

  • 0
            $tmp_im = imagecreatetruecolor($width, $height);
            $x = $this->getX();
            $y = $this->getY();

            $w = floor($resize_height * ($x / $y));
            $h = $resize_height;

            $this->tmp_im = imagecreatetruecolor($w, $h);

                            imagealphablending($this->tmp_im, false);
                            imagesavealpha($this->tmp_im, true);

                            imagecopyresampled($this->tmp_im, $this->im, 0, 0, 0, 0, $w, $h, $this->getX(), $this->getY());

            $this->im = $this->tmp_im;


            $hs = floor(($width - $this->getX())/2);
            $vs = floor(($height - $this->getY())/2);

            imagecopy($tmp_im, $this->im, $hs, $vs, 0, 0, $this->getX(), $this->getY());

            $this->im = $tmp_im;

the results is a poor quality resized image, what im doing wrong? i also tried to use a imagejpeg with quality = 100

  • 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-23T21:26:12+00:00Added an answer on May 23, 2026 at 9:26 pm

    Use imagecopytruecolor() instead of

    imagecopy($tmp_im, $this->im, $hs, $vs, 0, 0, $this->getX(), $this->getY());
    

    This is a Notice on the official PHP documentation page:

    There is a problem due to palette image limitations (255+1 colors).
    Resampling or filtering an image commonly needs more colors than 255,
    a kind of approximation is used to calculate the new resampled pixel
    and its color. With a palette image we try to allocate a new color, if
    that failed, we choose the closest (in theory) computed color. This is
    not always the closest visual color. That may produce a weird result,
    like blank (or visually blank) images. To skip this problem, please
    use a truecolor image as a destination image, such as one created by
    imagecreatetruecolor().

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

Sidebar

Related Questions

I'm trying to initialize string with iterators and something like this works: ifstream fin(tmp.txt);
In c# double tmp = 3.0 * 0.05; tmp = 0.15000000000000002 This has to
rm -r /cbbconfg/BRCH/tmp rm: cannot determine if this is an ancestor of the current
im trying to complete this function, it seems to be working great except for
i'm trying to retrieve the current date via unix time like this: long unixTime
Is there a simple way of generating a new Route-URL without all this faff.
Hi im having an interesting problem. Update: From the comments im getting below this
Im getting this error: Error: Command failed: execvp(): Permission denied When I do a
Im having this error appear on chef-solo recipes, Im new to it so I
im gettin this really annoying error message. I know Im only new to this

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.