Results 1 to 2 of 2

Thread: How to Invert White on Black Photo to Black on White?

  1. #1
    Join Date
    Mar 2018
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to Invert White on Black Photo to Black on White?

    Hi,

    I have a bunch of images constantly coming in to the website which are white writings on black background.

    I want to change it to black writings on white background. Would deeply appreciate if you can send me a link to a tutorial or a sample script.

    Thanks!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,497
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This is actually quite easily done in css:

    Code:
    filter: invert();
    So you could give all of your white on black images a class name:

    Code:
    <img class="whiteonblack" src="whatever.jpg">
    Then in your stylesheet have:

    Code:
    .whiteonblack {
    	filter: invert();
    }
    This can also be done in javascript, but this is simpler and uses the same css property. If you want to actually transform the image, so that you end up with an inverted image, you would need to use server side code. But this is simple and effective and support by almost all browsers.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Replies: 2
    Last Post: 08-24-2016, 01:56 PM
  2. Ultimate Fade-in slideshow background colour black to white
    By steve74 in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 11-26-2010, 04:33 PM
  3. Replies: 1
    Last Post: 09-26-2009, 02:11 AM
  4. fireworks: GRADIENT: white -to- full color photo
    By leonidassavvides in forum Graphics
    Replies: 1
    Last Post: 05-18-2008, 07:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •