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

  • Home
  • SEARCH
  • 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 7022047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:31:46+00:00 2026-05-27T23:31:46+00:00

While i was doing some image processing, i found out that GD and Imagick

  • 0

While i was doing some image processing, i found out that GD and Imagick in PHP does not resize image to color pixel identical level, which in most cases, were not needed.
Now in case, i need a image from whatever dimension to scale to 256*256

To make sure the TEST results are consistent, i used a 256*256 image and resize it to it’s own size.

what i’ve attempted:

imagecopyresized($new, $img, 0, 0, $x, 0, $width, $height, $w, $h); //256 , 256

and

$compression_type = imagick::COMPRESSION_NO;
$images_ima = new Imagick($image_path);    //$image_path = path to image...
$images_ima->setImageCompression($compression_type); 
$images_ima->setImageCompressionQuality(100); 
$images_ima->sampleImage($X_SIZE,$Y_SIZE); // 256 ,256
$images_ima->writeImages($dest_path, true); //destination path

none of them worked, if i compare the output with the original image, it will look something like this:
Araxis merge comparison on original VS resized

it looks like the functions i’ve used are resampling the image since the variations in the RGB value between both image are small

i can achieve pixel to pixel identical resizing from 256*256 to 256*256 in photoshop, OSX preview, and even Pixelformer.
i was wondering how can that be done i PHP?

  • 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-27T23:31:46+00:00Added an answer on May 27, 2026 at 11:31 pm

    Since your image format (jpeg – assumed from 100 quality setting) is a lossy format you won’t get a lossless throughput this way as you’re recompressing the image.

    You should try to detect image dimensions and use the original image if the dimensions are already correct.

    When you don’t change the dimensions (original dimensions = dimensions after resizing) in Photoshop or OSX preview they won’t recompress the image, that’s why you won’t see any change.

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

Sidebar

Related Questions

While doing some refactoring I've found that I'm quite often using a pair or
I'm trying to display an image while I'm doing some Ajax updating (which I've
We have a Mono application under Linux that does image processing on a bunch
Basically, I'm doing some sort of image processing using a screen-sized rectangle made of
I'm doing some heavy image manipulation in php and I would like to show
I have some scientific image data that's coming out of a detector device in
While doing some JavaScript performance tests I came up with the following piece of
While doing some random experimentation with a factorial program in C, Python and Scheme.
While doing some small regex task I came upon this problem. I have a
while doing some homework in my very strange C++ book, which I've been told

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.