ImageView with transparency

I have an ImageView which contains an Image that has transparency. The default behavior for ImageView is to not fire mouse events on parts of the image that are fully transparent. However, I want events on all pixels in the image, regardless of their opacity.
Rectangle has this behavior by default, that is, if you create a Rectangle like this:
var r = Rectangle {
fill: Color.color(0,0,0,0);
width: 136
height: 19
onMouseMoved: function(Void) {
println("mouse moved");
you'll see the printout even though the rectangle isn't visible.
Is there any way to do the same for ImageView?
-Ken

You almost answered yourself: a possible workaround is to put a transparent rectangle over the ImageView and let it handle the events.
Maybe there is something simpler or more elegant, but hey, if nobody else has a suggestion... :-)

Similar Messages

  • ImageView with transparent image not clickable

    I created an ImageView with an image with transparent portions. I also did some scaling and moving, which I though might cause this effect, but that is not the case. When I click on the transparent portion of the image the onMouseClick event is not fired. Other mouse events (mouse enter, mouse move, mouse exit, ...) get fired. Only when I click on the non transparent part the click event is fired.
    Image img = new Image(getClass().getResourceAsStream("barrel_icon.png"));
    ImageView view = new ImageView(img);
    view.setScaleX(0.5);
    view.setScaleY(0.5);
    view.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {
        System.out.println("Clicked on the scaled icon");
    StackPane root = new StackPane();
    Group group = new Group(view);
    group.setManaged(false);
    group.setLayoutY(-13);
    group.setLayoutX(-13);
    root.getChildren().add(group);
    The area between the barrel and the shadow belongs clearly to the image, however is transparent.
    I am wondering if there is a reason for this behaviour and what is the best way to work around this issue, as my image has large transparent portions and the non transparent parts are hard to click on.
    By the way this is all based on JavaFX 2.2.
    Regards
    Hotzst

    For future reference here is the workaround I have come up with:
    public class TransparentImageViewClickableArea extends Rectangle{
        private final ImageView imageView;
        public TransparentImageViewClickableArea(ImageView imageView) {
            super(imageView.getLayoutX(), imageView.getLayoutY(), imageView.getImage().getWidth(), imageView.getImage().getHeight());
            setOnMouseReleased(imageView.getOnMouseReleased());
            this.imageView = imageView;
            bindBounds();
        private void bindBounds() {
            DoubleBinding layoutXBinding = new DoubleBinding() {
                    super.bind(imageView.layoutXProperty(), imageView.scaleXProperty());
                @Override
                protected double computeValue() {
                    final double imgWidth = imageView.getImage().getWidth();
                    final double actualWidth = imgWidth * imageView.getScaleX();
                    double diff = imgWidth - actualWidth;
                    return imageView.getLayoutX() + diff/2;
            layoutXProperty().bind(layoutXBinding);
            DoubleBinding layoutYBinding = new DoubleBinding() {
                    super.bind(imageView.layoutYProperty(), imageView.scaleYProperty());
                @Override
                protected double computeValue() {
                    final double imgHeight = imageView.getImage().getHeight();
                    final double actualHeight = imgHeight * imageView.getScaleY();
                    double diff = imgHeight - actualHeight;
                    return imageView.getLayoutY() + diff/2;
            layoutYProperty().bind(layoutYBinding);
            widthProperty().bind(imageView.getImage().widthProperty().multiply(imageView.scaleXProperty()));
            heightProperty().bind(imageView.getImage().heightProperty().multiply(imageView.scaleYProperty()));
    It is not a perfect solution, as it does not consider the case that the image might be changed as well. This however could be improved easily but was not necessary in my use case.

  • Animated gif with transparent background

    When I import in Keynote an animated gif with transparent background. The background becomes white. I did the following tests:
    If I extract a single image from the animated gif and import it in keynote the background is actually transparent but it becomes white when I import the whole gif.
    I also checked with other applications (NeoOffice) and the animated gif does come out with a transparent background.
    Do I do something wrong in Keynote ?

    This has been an ongoing issue for me since I switched from Powerpoint to Keynote. Most of the animated gifs with transparent backgrounds that I used with Powerpoint are no longer transparent in Keynote. You may want to search for those earlier threads on this topic...
    To summarize: I've had to open up my animated gifs in After Effects and use the Color Key effect to restore transparency, with mixed success.
    Good luck!

  • Creating animations with transparent backgrounds?

    I'm running into some problems when using After Effects to create animations with transparent backgrounds for Keynote...
    I use animated gifs and short quicktime movies with uniform backgrounds as source files, use color keying to take out the backgrounds, preview them to see if they look OK, render the results as RGB+alpha, and... they don't show up as transparent in Keynote. They work in Powerpoint, however. I've tried outputting as .mov, as .gif, as premultiplied vs straight alpha... no joy. Can someone explain (or point me to an explanation) of how Keynote differs from other programs in its handling of transparency? What am I missing?

    Using a TYPE_INT_ARGB BufferedImage worked beautifully. I had played around with Image for hours, but it never occurred to me that BufferedImage would be needed. :)
    many, many thanks,
    Steven

  • How do i export a flash movie as an animated gif with transparent background?

    each export has the background in it.
    I have looked into the publish setting for gif but no option there, or in the background colour setting in the main design window has any Alpha or Transparency setting.

    Thought that issue went away. The only workaround I found was exporting a PNG sequence with transparency, importing it all back into a better animated GIF exporter like Fireworks as an image sequence and exporting it from there again. It will give you the best quality, control over the timeline, looping and various per-frame AGIF functionality.
    But yes, it's a multi-step headache.

  • How do I transfer a .psd file to illustrator that can then be placed in Muse as a .svg with transparent background?

    I just wrote all this up in another thread.  I did not realize at the time that the last post was in 2014, so I'm giving it a go here.
    I am currently trying to create an .svg using Photoshop .psd file (with layers in tact).  I'm new to these products so it may be obvious to others that the above intention was to eventually place the .svg in some sort of website creation software such as Muse.  Which is precisely what I am attempting. However, I am getting a white background once I place or copy and paste into Muse.  My starting .psd has a transparent background without any hidden layers causing this problem.  To test this I placed the .psd file into Muse and it still has a transparent background.  However when opening or placing this file into illustrator, it picks up a white background. If I do exactly as described above, I still get the same result.  So far I have tried:
    1) Simple copy and paste from Photoshop .svg to illustrator to Muse.  Result - white background.
    2) Placing the .psd in illustrator, then placing the .svg file in muse.  Result - white background.
    4) I have also tried the every combination of 1 and 2. - Result - white background.
    3) I have now created a path in Photoshop from the text layer to yet again attempt the above methods.  Result - white background.
    I'm including an image of the object I am trying to place with transparent background, but I have both a flattened rasterized version, a version complete with layers and a third (.svg) with the corresponding objects.  I am completely new to Illustrator as of today so any help would be greatly appreciated.  Thanks.
    Link to .psd file "Welcome text"

    I was having some difficulties getting the correct dimensions of one of my objects, I eventually solved this problem without using svg.  It was pretty simple when I stopped trying to over complicate things.  I just linked the object to a near by object in photoshop, merged and placed it all as one.  It looks great now.  Thanks for your reply.  You are correct, SVG was not the answer.

  • Problem with PDF 1.3-Export: Photoshop-Files with transparency over InDesign colored objects

    Hello!
    I'm using InDesign CS6.
    I'v finished now a layout for a folder, and I put a photoshop-image with transparency over a InDesign-rectangle which I have filled with a cmyk-color in yellow.
    When I export a PDF with the Settings "PDF X-3:2002" (with PDF-Standard 1.3) the Photoshop-image shows uggley jagged edges at the border to the InDesign-colored background. However, the Photoshop-images which are over another bitmap-image (as background), this images don't show this annoying edges.
    When I export to PDF-Standard 1.4 the problem doesn't occor, however my printing-service requests PDF 1.3.
    I know, the workaround for this problem is, to replace the yellow background-color with an bitmap-file with the same color, but is there any other option to get a correct result without this more time-consuming image trick?
    I think it has to do with the transparency reduction which is necessary if using PDF 1.3. When I examine the PDF-File in Illustrator, this edges occurs mostly at the borders from the tiles in which the image is cut during the transparency reduction process. Although, if I open the rendered PDF in Photoshop this jagged edeges are visible, so it is definitly a render error.
    I would be glad if someone of you has a solution for this problem, in the attachment is an image which illustrate the problem.
    Best wishes

    Find another printer.
    End of problem. It really saddens me to think that these Luddites are
    still in business making no effort to move into the 21st century.
    Bob

  • Creating a PDF with Transparent Images

    Hi,
    Here is my problem:
    I am using Acrobat 9. I design posters in another program. I print to PDF.
    I design the poster and must put a logo in it with a transparent background. Note: If the poster background is white I never have any problems.
    This poster has a pink background and hence I have to put the logo into the poster in a graphic type of gif or tiff or png to maintain transparency.
    All is fine in my design program - transparency is fine etc.
    I print to PDF (Acrobat 9.0) and the dreaded white box occurs. Note, I put an old version of the logo, one I cannot use, and it maintained its transparency fine. So this means that some gif files Acrobat 9.0 keeps transparency and some it does not.
    So, in summary, I have tried all types of file formats gif, png, tiff and all types of programs to remove the logo background and save as one of the later formats and NONE maintain the transparency in the PDF output.
    I have even tried saving the whole poster as a jpeg - but the quality was too poor to print.
    I have used Word, Photoshop, MS Photodraw, Elements etc.
    I have no idea why a gif I have from years ago works and one that I am creating now maintain their tranparency in the PDF.
    I am under a deadline and am VERY worried this will not get done.
    I am immensely grateful for any help - I have been at this for countless weeks and hours...
    Thanks,
    Elisabeth

    I am using MS Publisher and even Word 2010 for poster design and have used multiple programs (and multiple formats that support transparency)  for logo editing - removal of background - Photoshop, etc.
    I place logos, both gifs, with transparent backgrounds in a document and print PDF and one or none will show transparency - it makes no sense at all.
    Most of the time the background is a white block. It couldnt be more frustrating.
    It is a simple document/poster with just a few words of text and a logo...
    Are there settings in Acrobat 9.0 that need to be turned on that I am missing. I had no trouble with Acrobat 7 - it worked EVERY time.
    I was on  with tech support for 5 hrs and there was no knowledge of this - he just wanted to reinstall 7.0 which did not work.
    Need ideas - overprinting is on. I noticed that flattening doesnt allow me to pick transparent objects - have no ideas if I am even on the right track.
    Have read everything I can find online regarding Acrobat 9.0, PDF creation and transparent logo backgrounds.
    Sooo grateful for any help!
    Thanks,
    Elisabeth

  • Want to create an oval vignette in photoshop elements 10 with transparent background for printing w

    I am fairly new to PSE and I want to create an oval vignette in Photoshop Elements 10 with transparent background for printing on white paper using MS Publisher. Using the white background on inverse selection makes a slight line impression and either it should have a defined "frame" or nothing.
    Appreciate any guidance.

    Try with the Elliptical marquee tool:
    On the tool's option bar set feather 25-40 px (experiment)
    Drag out the Ellipse to embrace the object
    Go to Layer>new>layer via copy, or CTRL+J
    Your selection should fade out as a vignette and be surrounded by transparency
    Save this layer via File>save for web, select PNG-24, and tick "Transparency"

  • I place a psd file with transparent background on another layer in my InDesign document. The layer b

    I placed a psd file with transparent background on another layer in my InDesign document. The layer below has a color (RGB). When the psd file is placed it changes the color on the layer below. I've tried other psd files thinking something is wrong with my file, but get the same result. I have tried for days to figure this out. Can anyone help me?

    Wow, thank you! That was fast. I googled that question to death and even bought (another) book on CS5 and never saw that answer. Thank you so much. You made a very good ending to my day! I'd buy you a beer if I could!!

  • How to save an icon as a bitmap file in illustrator with transparency?

    Hello I need help,
    I don't normally work with bitmap files however I find myself in need to save out a set of icons in this particular format for a client to use with their own software on a pc. this software can only import/use .bmp files.
    In my export options .bmp is an option but I am unable to save it out with a transparent background which is a big issue. The result is an icon with white background and I need it to be transparent.
    I tried pasting these icons to photoshop but I only is a portable bitmap format in the "save as" menu which I don't think will work as it creates a .PMP file and I don't think it will work with client's software. I am on a mac, with illustrator CC as well as photoshop.
    I would very much appreciate help with this, I have been trying to figure this out for 2 hours now. Thank you in advance.

    When I have created bitmap icons in the past (used to work for a software company) I used to create them with either a icon creator tool (Axialis) or directly in photoshop.
    For color depths 24 BPP or less, the transparency is coded by using a fixed color. Each pixel that have this exact color will be converted as transparent when the image is loaded in the toolbar. Usually, the color used is green RGB(0,255,0) or magenta RGB(255,0,255). The problem of this method is that if you use a pixel of that color in your icon image (not the background), it will be converted as transparent. The other issue is the poor quality of the borders (around the icons) because it does not permit smooth transparency. In other words, a pixel is either 100% transparent or 100% opaque, there is no variable transparency. It results in "aliasing" on borders for icons with rounded shapes.
    This is an old technique so you will struggle to get the desired results but worth you having a look for "creating bmp icons with transparency" online.

  • Changes to appearance of repeat swatch and gradient (both with transparency applied) when .ai saved in PDF 1.3 compatibility

    I need to send a complex vector print to a commercial printer who requires my .ai file to be saved as 1.3 PDF compatibility.  All the graphics display & print correctly bar two elements:
    1. A gradient with transparency applied
    2. A repeat pattern swatch with transparency applied
    Both of these elements are layered between a solid colour background and a complex array of vector art.
    The gradient displays as solid white when converted to 1.3 PDF.  The pattern swatch displays partly white, with some elements of the pattern repeat visible as a watermark.
    1. I have tried to rasterise these elements within the a@rt, and while they both display correctly while in .ai format, as soon as I convert to PDF the appearance changes as above.
    2. I have tried to apply the transparency to the paint buckets on the gradient slider instead of applying it to the shape with gradient fil
    3. I've fiddled with the Transparency Flattening presets, Document Raster Effect Settings, and everything I can think of in the 'Save as PDF' dialogue box
    4. I've tried to rasterise the full file with an even worse outcome (all colour information lost, appears only on grey scale with fewer elements visible)
    Could this have something to do with spot colours or overprint?  Any help would be most appeciated!
    I'm using:
    Illustrator CC 18.1.1 (doc colour set to CMYK)
    on a Macbook Pro OSX Yosemite Version 10.10.1
    Apple Preview Version 8.0 (859)

    Hi Mike,
    Thanks for taking an interest! I tried rebuilding my gradient as suggested to see whether it would make a difference, but was still having issues.  Tried to save every which way with the save as PDF options in 1.3 profile.  Finally went back into the file to unpack each layer and see what I could adjust to save the appearance.
    Found this fix in my swatches palette: for some reason the swatches I was working with had converted to "Book Colour", something I never use.  I changed the dropdown back to CMYK and changed the colours from spot to process, which fixed the file    Relief after hours of searching and late nights!
    Thanks again!

  • Images with transparent backgrounds in MDM

    I've got several images in MDM with transparent backgrounds, yet when i look at these in image manager (or thumbnails in data manager) they look terrible. The transparency is black for example, among other issues. These images are all okay in photoshop, they have been saved as .png and imported through the data manager.
    Has this import ruined these image files on the way in? When my search engines etc extract the images, what of the transparencies?

    Hi Adam,
    MDM makes use of Internet Explorer quite frequently. I can imagine that this engine is also used to display images in MDM. However, Internet Explorer in version 6 does not support transparency in PNG images. That is why the black background occurs.
    Since your images after upload are only saved in a binary object in the database, you should not encounter any data loss when using the same images. If you need to create variants, I would consider using Photoshop for the creation of those.
    I hope that helps you further.
    Best regards
    Christian

  • Image with transparent background shows up with a white background in ID

    Amateur needs help.
    I have a copy of a logo with a transparent background.  I made the (white) background transparent in PS by creating a layer from background and then selecting the white color in the background and deleting it.  This has always worked in the past.  But when I place this image into ID, it shows up with a white background.  I have tried saving as a PSD, TIF, JPG, etc.  I cannot get it to work. 
    I normally research these things until I find an answer, but I am on a tight deadline.  Thanks!

    I totally forgot to put that in my post.  Yes, I am putting logos with transparent backgrounds in front of colored rectangles.  That's how I noticed that this one logo is showing up with a white background.  The weird thing is that the other two logos are fine.  I did find a different version of this logo and this one works fine.  The one that works fine is a JPG and the one that shows up with a white background is a JPG.

  • Combining 100 pngs with transparent background, vertically into one image PSE9

    As the question suggests,
    In PSE9 is it possible to combine 100+ PNG files (with identical dimensions & transparent background) into a single PNG file where the images are stacked vertically? and without trimming/cropping the transparent part of the image! I want to retain the exact original image dimensions so that they all stack neatly and precisely. 
    So far what I've tried is opening up the 100 PNG files in PSE9, create a new document with transparent background using the same width as the individual files and the height set to the individual file height multiplied by 100. (i.e. original image is 36 x 120 so the new file will be 36 x 12000) Then I get stuck! Whenever I drag a single file into the newly created document, it seems to be cropped to the image edges and no longer retains it's original height and width. Not to mention that hand dragging 100 files seems like a long-winded way of doing things... My automate button seems to be greyed out (so no contact sheet?) and I can't find any other automated process.
    Any help would be greatly appreciated,
    Thanks
    N.
    PSE 9 on Win 7

    Please compare the resoultion of the two documents too. And a better way of arranging the layers would be to use distribute option in the move tool. You can find more about the move tool at http://helpx.adobe.com/photoshop-elements/using/moving-copying-selections.html#main-pars_h eading_0
    Thus your workflow would be:
    Create a new document with the required dimension.
    Use File>Place to place all your png files on the created document as layers
    Use distribute option in move tool
    A still better workflow would be to use put all the files in a folder and write an ExtendScript to read the files and place them as layers on the document of said dimension

Maybe you are looking for

  • Mail Spell Check Needs a LOT of Work

    How do we get Apple to make major improvements to their MAIL Program?  I love the program and it's ease of use, but the SPELL CHECK adn GRAMMAR CHECK leaves a lot to be disired.  I will NEVER say that Outlook is a better mail program BUT it does a su

  • Business Partner Replication Documents

    Need Business Partner Replication Documents

  • Mail crashes while trying to read "Table of Contents"

    Whenever I try to open Mail, it sits there trying to read the table of contents, after about 30 seconds, it starts to play with the beach ball, then quits. I've tried repairing disk, permissions, and removing all the files I can think would help. I'v

  • HT3986 I want to run sage on my Mac Mini

    Hi I want to run sage instant or 50 on my Mac Mini, is boot camp with Win 7 compatible? Thanks in advance

  • Sharing transaction between regions and creating new records

    Hi all, To simplify my scenario, I will use HR scema. I have a fragment department.jsff. This one is showing records from a Departments table in a panelFormLayout. In here I have a button NEW that is bound to the CreateInsert operation from Deparment