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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:06:11+00:00 2026-05-28T08:06:11+00:00

I need to make this effect with php. I know that there is IMG_FILTER_PIXELATE

  • 0

I need to make this effect with php. I know that there is IMG_FILTER_PIXELATE in PHP image filter. But I need it to be smoother and embossed? like in this image:

image

This effect will make any image uploaded by user become pixelated and the edge of the picture become red (I know IMG_FILTER_EDGEDETECT but I don’t know how to use it to change edge color).

I have no idea how to do this.

  • 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-28T08:06:11+00:00Added an answer on May 28, 2026 at 8:06 am

    As the last answer was theoretical and seemed to be not enough, I’ve created a practical example:
    Note: This is far from the “ideal” and perfect pixelate effect function, but it does it’s job. Feel free to edit it according to your own needs.

    <?php
    /* Function to make pixelated images
    * Supported input: .png .jpg .jpeg .gif
    * 
    *
    * Created on 24.01.2011 by Henrik Peinar
    */
    
    
    /*
    * image - the location of the image to pixelate 
    * pixelate_x - the size of "pixelate" effect on X axis (default 10)
    * pixelate_y - the size of "pixelate" effect on Y axis (default 10)
    * output - the name of the output file (extension will be added)
    */
    function pixelate($image, $output, $pixelate_x = 20, $pixelate_y = 20)
    {
        // check if the input file exists
        if(!file_exists($image))
            echo 'File "'. $image .'" not found';
    
        // get the input file extension and create a GD resource from it
        $ext = pathinfo($image, PATHINFO_EXTENSION);
        if($ext == "jpg" || $ext == "jpeg")
            $img = imagecreatefromjpeg($image);
        elseif($ext == "png")
            $img = imagecreatefrompng($image);
        elseif($ext == "gif")
            $img = imagecreatefromgif($image);
        else
            echo 'Unsupported file extension';
    
        // now we have the image loaded up and ready for the effect to be applied
        // get the image size
        $size = getimagesize($image);
        $height = $size[1];
        $width = $size[0];
    
        // start from the top-left pixel and keep looping until we have the desired effect
        for($y = 0;$y < $height;$y += $pixelate_y+1)
        {
    
            for($x = 0;$x < $width;$x += $pixelate_x+1)
            {
                // get the color for current pixel
                $rgb = imagecolorsforindex($img, imagecolorat($img, $x, $y));
    
                // get the closest color from palette
                $color = imagecolorclosest($img, $rgb['red'], $rgb['green'], $rgb['blue']);
                imagefilledrectangle($img, $x, $y, $x+$pixelate_x, $y+$pixelate_y, $color);
    
            }       
        }
    
        // save the image
        $output_name = $output .'_'. time() .'.jpg';
    
        imagejpeg($img, $output_name);
        imagedestroy($img); 
    }
    
    
    pixelate("test.jpg", "testing");
    
    
    ?>
    

    This is the example function to create pixelated effect on images.
    Here’s an example results of using this function:
    Original:

    Pixelated 5px:

    Pixelated 10px:

    Pixelated 20px:

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

Sidebar

Related Questions

I need to make an emboss effect for an image in PHP. But I
Sorry if this sounds like a really stupid question, but I need to make
I need to make this design: http://www.stephburningham.com/lmg/ into a joomla template but I've never
I need to make a query like this: SELECT PNPDeviceID FROM Win32_NetworkAdapter WHERE AdapterTypeId
I'm playing with GAE, and need to make a query with something like this:
Hello all im trying to make this slide effect http://tinyurl.com/628z32d but im new to
I need to make this function work everywhere, except IE6-7 $(function(){ window.scrollTo(0,300); }) Please
Not sure exactly what I need to do to make this work, so my
I Need to make a webpage. asp.net this webpage recieve parameter by using Request.Querystring
I need to make a query to one of Google's services. I read 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.