It is currently Thu Apr 18, 2024 6:30 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Transfer colors from one image to another (script)
PostPosted: Sun Nov 29, 2015 10:08 pm  (#1) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
There's probably already something that does this :oops: ...but I wrote a simple script that does this.

You need to have an image, and another image to grab colors from.
Script will be available under Script-Fu/Create New/Transfer colors...
Attachment:
TransferColor.scm [2.3 KiB]
Downloaded 391 times


here are samples of what i did.
Mona lisa using colors from starry night and vice versa.
Image
Image

and here i just made an image with gradients from black to dark red, from dark red to medium blue and from medium blue to light green and then from light green to bright yellow and used it as color image to transfer colors from.
here's the result
Image

_________________
TinT


Last edited by trandoductin on Mon Nov 30, 2015 3:44 pm, edited 3 times in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Transfer colors...
PostPosted: Mon Nov 30, 2015 10:48 am  (#2) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 5128
Location: Metro Vancouver, BC
Interesting Tin, I'll give it a go.
{Edit}
I don't think it should permanently change the state the original image. If you want to run it again with a different color count you have to revert the original.

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Transfer colors...
PostPosted: Mon Nov 30, 2015 11:56 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Odin, the filter creates a NEW image.
Thus, you can repeat it by setting again active the image you want to change, change the parameters and run the filter.

Edit: I understand what you meant: it's the SOURCE image that is permanently changed! Yes it's an error IMO too.

_________________
"Where am I ?"


Top
 Post subject: Re: Transfer colors...
PostPosted: Mon Nov 30, 2015 12:14 pm  (#4) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 5128
Location: Metro Vancouver, BC
dinasset wrote:
Odin, the filter creates a NEW image.
Thus, you can repeat it by setting again active the image you want to change, change the parameters and run the filter
Yes, a new image is created but my source image changed as well.

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Transfer colors...
PostPosted: Mon Nov 30, 2015 12:15 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Tin,
it looks interesting, I guess you have to correct what noticed by Odin

_________________
"Where am I ?"


Top
 Post subject: Re: Transfer colors...
PostPosted: Mon Nov 30, 2015 1:45 pm  (#6) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
thanks Odin.
I have made it to create a new image (copy of the source image to grab colors from) and work on that then delete it after so that source image is unchanged.
PS... I was hoping to see people's play with stealing colors from other masterpieces/paintings.

_________________
TinT


Top
 Post subject: Re: Transfer colors...
PostPosted: Mon Nov 30, 2015 2:26 pm  (#7) 
Offline
GimpChat Member

Joined: Jul 11, 2010
Posts: 349
@trandoductin
there was a script a long while ago, that had the same name and the same purpose. Maybe people think it is the same script? I had limited success with that script. I have downloaded yours to try when I get a chance.

Also, you may want to mention that it is a script in the title so people interested in scripts will take a look.


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Mon Nov 30, 2015 2:42 pm  (#8) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
:hehe There i changed the title.

here i used gradient from black to dark blue, dark blue to yellow and yellow to white.
Image

_________________
TinT


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Mon Nov 30, 2015 9:28 pm  (#9) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
http://www.silent9.com/blog/archives/16 ... Match.html

An example here:
viewtopic.php?f=9&t=3263

It is quite a bit different in operation that yours, though, as it actually tries to preserve the histogram's shape when mapping. The convert to indexed and remap palette you implemented is definitely faster.

There was also the gimp Match Colours script here: http://www.ve3syb.ca/software/gimp/myscripts.html based on this technique

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Mon Nov 30, 2015 11:43 pm  (#10) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
RobA wrote:
http://www.silent9.com/blog/archives/162-Gimp-Script-Histogram-Match.html

An example here:
viewtopic.php?f=9&t=3263

It is quite a bit different in operation that yours, though, as it actually tries to preserve the histogram's shape when mapping. The convert to indexed and remap palette you implemented is definitely faster.

There was also the gimp Match Colours script here: http://www.ve3syb.ca/software/gimp/myscripts.html based on this technique

-Rob A>

Histogram match sounds much more advanced than my script... faster isn't always better.. I'll have to give this histogram match a try..very curious. thanks..

_________________
TinT


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Wed Dec 02, 2015 6:50 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Always more than one way to do things in GIMP. Nice to have choices and thank you for this script Trandoductin.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Wed Dec 02, 2015 12:57 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
one try (256 colors)

starting image (a photo half manipulated by gmic)
Attachment:
DSCF1060_base.jpg
DSCF1060_base.jpg [ 145.41 KiB | Viewed 1343 times ]


source of colors
Attachment:
Anderson_Sophie_An_Autumn_Princess_crop.jpg
Anderson_Sophie_An_Autumn_Princess_crop.jpg [ 266.59 KiB | Viewed 1343 times ]


outcome
Attachment:
DSCF1060_transfer_Anderson.jpg
DSCF1060_transfer_Anderson.jpg [ 243.43 KiB | Viewed 1343 times ]


it looks nice!

_________________
"Where am I ?"


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Wed Dec 02, 2015 1:07 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
second try

same base image

source of colours
Attachment:
Bouguereau_William_La_frileuse_Chilly_girl_crop.jpg
Bouguereau_William_La_frileuse_Chilly_girl_crop.jpg [ 206.08 KiB | Viewed 1341 times ]


outcome
Attachment:
DSCF1060_transfer_Bouguereau.jpg
DSCF1060_transfer_Bouguereau.jpg [ 340.29 KiB | Viewed 1341 times ]

_________________
"Where am I ?"


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Wed Dec 02, 2015 1:53 pm  (#14) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
The match color script mentioned by RobA does a much nicer job since it blurs the colors and keep luminance ...and you don't get this "shoddy" looking kind of images.
Image
Image

_________________
TinT


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Wed Dec 02, 2015 2:14 pm  (#15) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
here's results for what happens if you use shoddy version of my script and then used the decompose and recompose and blur colors of match colors's script
Image
Image

_________________
TinT


Last edited by trandoductin on Wed Dec 02, 2015 2:46 pm, edited 1 time in total.

Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Wed Dec 02, 2015 2:32 pm  (#16) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
downloaded and experimented also with Kevin's filter; got very smooth results, as you say.
Nice to have both!

_________________
"Where am I ?"


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Thu Dec 03, 2015 4:46 pm  (#17) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
dinasset wrote:
downloaded and experimented also with Kevin's filter; got very smooth results, as you say.
Nice to have both!


All these scripts are limited to 256 colors... So i wrote a standalone script/program that transfers colors based on luminance values.
But it's taking really long to run since it tries to replace pixel by pixel. I ran it for 2 hours already on your sample images and it's still running..almost finished now. I'll post the result when they're done running...
Not sure if anyone wants the program since it's so slow..but the result should be interesting since it's much richer in colors (or at least i hope so).

_________________
TinT


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Thu Dec 03, 2015 5:47 pm  (#18) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
here's one of them... not as cool as i had hoped.
Image

_________________
TinT


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Thu Dec 03, 2015 5:49 pm  (#19) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
here's the other
Image

_________________
TinT


Top
 Post subject: Re: Transfer colors from one image to another (script)
PostPosted: Thu Dec 03, 2015 6:17 pm  (#20) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
using proportion colors i get these results (runs much faster like within 10 seconds i get result).
Image
Image

_________________
TinT


Top
Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts How do you count colors in an Image in Gimp?

2

No new posts how to transfer one shape onto another

3

No new posts Attachment(s) transfer filter settings to new version

7

No new posts Problem in startup and file transfer 2.10.12

10

No new posts Attachment(s) DIEGO Transfer Colours Plug-in for GIMP 2.10

23



* Login  



Powered by phpBB3 © phpBB Group