*
The moose likes General Computing and the fly likes Transparent Background Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Transparent Background" Watch "Transparent Background" New topic
Author

Transparent Background

Joe Ridener
Ranch Hand

Joined: Jul 16, 2012
Posts: 86
I am putting a JPG image file on my web-site and have things behind it that I want to be visible. What is the easiest way to add transparency to a .JPG file's back ground color?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

There isn't. JPGs cannot have transparent backgrounds. I suggest using a PNG.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joe Ridener
Ranch Hand

Joined: Jul 16, 2012
Posts: 86
Once converted to a .PNG what would I do?
Joe Ridener
Ranch Hand

Joined: Jul 16, 2012
Posts: 86
You can look at it if you want to...

It is http://www.joerdesigner.net

It is a simple text image that can be redesigned... the image simply needs to have a transparent background. I do not necessarily need to add a transperant bg to an existing file as it can be created from scratch... I simply need a decorative font (cursive like) and a transparent bg.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

In Photoshop, or similar tool, mask out the parts you want to make transparent and remove them. Save as a PNG with transparency enabled.

You could also use a GIF, but PNG is a more modern format that also supports partial transparency via an actual alpha channel. GIFs just fake it.
Joe Ridener
Ranch Hand

Joined: Jul 16, 2012
Posts: 86
Bear Bibeault wrote:In Photoshop
You could also use a GIF, but PNG is a more modern format that also supports partial transparency via an actual alpha channel. GIFs just fake it.



Cool thank you thats what I was looking for...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

Your site just displays a black page.

In any case, creating a new image is even easier. In Photoshop (or Pixelmator, Gimp, etc) create a new image of the correct size with a transparent background. Add the text or whatever else you want. Save as a PNG.
Joe Ridener
Ranch Hand

Joined: Jul 16, 2012
Posts: 86
Bear Bibeault wrote:

Your site just displays a black page.

quote]

Hmmmm.. shoot

I had the same problem on someone elses PC. It displays fine on some but not on others. It is a JApplet.


Thanks for the referal though...

So you can set the Opaque and Transparncy (alpha) compnent on these?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

Oh. Applets are not a modern technology you should be using. In fact, because of a recently-found exploit, applets are automatically disabled on a number of different browsers. I'd advise learning how to use HTML/JavaScript/CSS for web sites in place of antiquated Java applets.
Joe Ridener
Ranch Hand

Joined: Jul 16, 2012
Posts: 86
Yeah. I am not too terrile with the three JS,HTMLS & CSS but I can do more with an Applet, such as animation and greater freedom. But the down side is sometimes it is automatically disabled. Is there a way to check ahead of time and perhaps add a JS function using the document.write to display either the HTML version of a page or the JApplet version before the page loads?

To see if the browser will accuratly display the page??
Or is their any way around it other then simply not using the page I put a ton of hard work into?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

I'm not sure about detection as applets are something I'd never use. I'd suggest asking in the Applets forum.

And yeah, there are others who have sunk a lot of work into applets, but the sad fact is that they are the 8-track cassette of the web. Shifting away from them now would be better late than never.
Joe Ridener
Ranch Hand

Joined: Jul 16, 2012
Posts: 86
Of the software available that can do this which would you recomend...

I am good w/ ColorPic, hexadeciaml digits and rgb for things like GradientPaint objects and familiar with Rastars and ColorModel Objects as well. And familiar w. the Alpha component as far transparency vs. Opaque goes. Kind a want to avoid a big new learning experience although creating image files is inevitable part of the path. Still just want something quick and usefull like ColorPic for something like this with maybe some other cool features I might like that are easy too.

Any recemodations?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

I use one of Photoshop or Pixelmator.
 
Consider Paul's rocket mass heater.
 
subject: Transparent Background
 
Similar Threads
Whizlabs pearl.
.gif --> jif or gif
Sorting Issue Help Needed Badly
More than one in XML tag?
web.xml template - very important for exam