Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Tutorials and Tips

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 10-16-2012, 03:17 PM
PTGigi's Avatar
PTGigi PTGigi is offline
Crazily Friendly~HoF
 
Join Date: Jul 2009
Location: Somewhere >.>
Posts: 370
Gender: Female
Credits: 37,903
PTGigi
Default

Recoloring an image is pretty easy, just kinda annoying to do. I'll be using GIFs as an example, because this method changes color by individual pixels, and PNGs can have lots of colors while GIFs generally have a more defined palette.

For this, we use the function imagecolorset as well as imagecolorexact. imagecolorset changes the defined color to a new one, while imagecolorexact picks the exact color we want to change. There are other functions to grab colors as well, but I find imagecolorexact to be the more flexible (there is also imagecolorclosest, which I've never tried to use and just discovered while typing up this tutorial. Sounds nicer though (grabs a color close to the one you selected if the one you selected doesn't exist), so I almost suggest using that XD). There's also imagecolorat which just defines it based on the specified pixel (x,y). It's very inflexible, so I don't really suggest using it.
PHP Code:
 <?php
 header
('Content-Type: image/gif');
 
$img imagecreatefromgif('imageurl');
  
 
$changecolor=imagecolorexact($img,255,255,255);
 
imagecolorset($img$changecolor255255255);
  
 
imagegif($img);
 
imagedestroy($img);
 
?>
Changing colors relies on RGB color values. If you don't know RGB very well, I'd suggest looking for a color picker that shows RGB values or a looking for a hex to RGB code snippet for PHP. I prefer the latter ;D

imagecolorexact(IMAGE,RED,GREEN,BLUE);
IMAGE is your image. This is so it can get the color palette from your image
RED the red value of the color (value between 0-255)
GREEN the green value of the color (value between 0-255)
BLUE the blue value of the color (value between 0-255)

DERP. I DECIDED TO START WRITING THIS IN THE MIDDLE OF CLASS. But now I have work to do sooooooo this will be left half finished until I get around to it. Sorry XD
__________________


"I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are."~Mewtwo
My Adoptables|Nuzlocke Webcomic

Last edited by PTGigi; 10-19-2012 at 09:46 AM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing Side Bar Links GuardiansWish Questions and Supports 4 10-22-2012 08:18 AM
Editing adoptables Papyrus Questions and Supports 2 01-24-2012 05:53 AM
Editing the HTML side of the CSS? Sasoragon Questions and Supports 6 02-17-2011 09:40 AM
Editing Content Rozel Questions and Supports 4 01-29-2011 12:14 PM
Editing pages. Saphira Questions and Supports 1 01-11-2009 04:46 PM


All times are GMT -5. The time now is 06:48 AM.

Currently Active Users: 3599 (0 members and 3599 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636