Modify the shape of image.

Hello!
I have a problem with the images and i don't have idea to solve it. Maybe some of you have more idea than me...
I want to reduce the size of one side of the image. But only one, is not useful to resize all the image.
The effect that I want is to simulate like one side of the image is more near than the other to me when I have the image in front of me.
Can you understand me?
I dont know where to start with this... Any help will be very usefull.
Thanks a lot!
Merry christmas!

Here, play around with this code. Scaling one side of the image does indeed make it look like it's rotating, but the direction of rotation seems to be in the eye of the beholder. Notice, to achieve the scaling I us an AffineTransform object. You can probably add some mathematical shear to the AffineTransform to achieve a better effect.
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.awt.geom.AffineTransform;
public class RotatingImageDemo extends JPanel implements Runnable{
    private String imagePath =
            "http://www.wiersma.org/project_images/java_duke.png";
    private BufferedImage img;
    private double scaleX;
    private double scaleIncrement;
    public RotatingImageDemo() {
        try{
            img = javax.imageio.ImageIO.read(new java.net.URL(imagePath));
            setPreferredSize(new java.awt.Dimension(img.getWidth()*2,
                                                    img.getHeight()));
            scaleX = 1.0;
            scaleIncrement = -.02;
        }catch(Exception e) {
            System.err.println("Could not load image for demonstration");
            e.printStackTrace();
            System.exit(0);
    public void addNotify() {
        super.addNotify();
        new Thread(this).start();
    public void run() {
        while(true) {
            try{Thread.sleep(30);}
            catch(InterruptedException e) {}
            repaint();
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        java.awt.Graphics2D g2d = (java.awt.Graphics2D) g;
        g2d.setRenderingHint(java.awt.RenderingHints.KEY_ANTIALIASING,
                             java.awt.RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setRenderingHint(java.awt.RenderingHints.KEY_INTERPOLATION,
                     java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR);
        AffineTransform transform = new AffineTransform();
        double x = (getWidth()/2-(img.getWidth()*scaleX)/2f);
        transform.translate(x,0);
        //OR
        //transform.translate(getWidth()/2,0);
        scaleX += scaleIncrement;
        if(scaleX < -1) {
            scaleIncrement *= -1;
            scaleX = -1.0 + scaleIncrement;
        } else if(scaleX > 1) {
            scaleIncrement *= -1;
            scaleX = 1.0 + scaleIncrement;
        transform.scale(scaleX, 1);
        g2d.drawImage(img, transform, null);
    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater( new Runnable() {
            public void run() {
                JFrame f = new JFrame();
                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                RotatingImageDemo imageDemo= new RotatingImageDemo();
                f.setContentPane(imageDemo);
                f.pack();
                f.setVisible(true);
}

Similar Messages

  • How do I modify the behaviour of "Image Sizing" Module in Export

    As part of the export process I want to re-size an image to a fixed size e.g., 5400x3600. The iamge should be scaled symmetrically and therefore some fill-in of black or white may be necessary.
    I know I can do this as a "post-process" action, but then I need to re-do sharpening, assigning colour profile etc.
    So is there a way in the SDK to "replace" the "Image Sizing" Module with one of my own making?
    Best wishes
    Terry

    You can disable the image sizing portion of the UI and use the updateExportSettings() function on your export service provider to force the image size to your desired size. (This function is not well documented. It takes a single parameter, exportSettings, which you may modify in place before the export starts.) For example (this would go inside your export service provider declaration):
    updateExportSettings = function( exportSettings )
        exportSettings.LR_size_resizeType = 'wh'  -- specific width and height
        exportSettings.LR_maxHeight = 3600
        exportSettings.LR_maxWidth = 5400
    end,
    hideSections = { 'imageSettings' },  -- hide the sizing panel
    However, there is not a way to get Lightroom to render a file that is cropped to a specific aspect ratio. Whatever sizing parameters are specified, we will always honor the aspect ratio of the source file. In your processRenderedFiles function, you could use a third-party tool like Mogrify to regenerate the output file with the fill necessary to satisfy the desired aspect ratio.

  • Aperture 3.3 Bug? Dragging to external editor can modify the original

    As a follow-up to the thread below I explored the role of the previews in Aperture:
    Edited image appears then quickly reverts to original?
    The problem: When dragging images from the Browser to Photoshop (supposedly passing along a preview of the image) the original image file in Aperture could be overwritten.
    Experimenting with this I found that the result depended on the size of the image, for the following reasons:
    If the Preview size was set to a larger value than the actual image size, then Aperture would not generate a preview for images without a preview, but pass the original image to Photoshop. Saving back the changes in Photoshop would modify the original master image file in the Aperture 3.3. For images larger than the Preview size, Aperture 3.3 would pass a new quasi master to Photoshop - rather wasteful, since this quasi master is not linked to a version and this not accessable in Aperture.
    Experimenting showed, that the same happens with dragging to GraphicConverter, but the changes to the original are only visible after quitting and relaunching Aperture.
    I would be grateful if someone could check out these observations:
    Do you also see, that no previews are generated in Aperture 3.3, if the original image is smaller than  the preview size set in the preferences?
    Can you confirm, that Photoshop modifies the original image files, if the image does not have a preview image, and if the image is passed by dragging from the browser?
    I tested the same in Aperture 3.2.4: Here it seems to be impossible to drag an imageto Photoshop and GraphicConverter, if it does not have a preview image - very sensible.
    Regards
    Léonie
    A modified original image returned from Photoshop:

    This still has not been fixed
    I just tried again in Aperture 3.4.3:
    I Imported this image file (pixelsize 260 × 551) into Aperture:
    Then I dragged it from the Browser to "Preview", annoted it with an arrow, pressed "Save".
    And now the Aperture browser shows this:
    Aperture 3.4.3,  MacOS X 10.8.3

  • Can I change the shape of the page background?

    For instance, round the corners of a straight rectangular template? I've seen that I can do this with no page fill, but I'd like to have a round-cornered page backgound with a color fill. Is that possible?

    Lola,
    I just played with it a few minutes to see if I could modify a blog and make it do some tricks.
    http://www.mireillegreen.com/Site_2/Blog/Blog.html
    I used the same shape that I had used earlier to show you that you could change the shape of your page if that is what you wanted. So the entry is OK I changed the shape of the mask to go with the circle idea that is in the blog entry click on the travel whatever and you will see that the photo is in an oval, but it does not get pickedup as an oval in the archive. So you could modify the shape of your blog page but you would have to keep in mind that the oval design would still have to deal with some square or rectangular shapes somehow.
    Thanks for asking this was fun to explore.
    Mireille

  • How modify the tabs of the portal

    Good day
    We have installed sp17,
    We need to modify the design of tabs of the portal, I know That it is
    in the themes, I can modify the tabs with images, but the only that does not allow me to place to an image is in the superior part of the tab.
    how can I do To place a line of another color in the top edge of the tab.
    Thanks,
    Cantv

    Hi,
    See this thread for ways of modifying the TLN: Customizing Top Level Navigation in Enterprise Portal
    Hope this helps.
    Daniel

  • How to create a shape based on the shape of an image

    I want to erase a portion of a mask based on the shape of an image. how can i do this? btw how to create a circle? thx

    Both your questions leave room for imagining what you might really mean, but here's a shot at answering them.
    If you have a mask that you want to erase portions of based on an image... assuming the mask is a simple rectangle you drew with the rectangle tool, change the opacity of the rectangle's fill in the color panel to make it see-thru, place the mask over the image, and using the eraser tool, erase the portions of the mask that you do not intend to retain using the image below it as a guide.
    As for drawing a circle, hover over the rectangle tool and a menu should appear.  Select the oval/ellipse tool.  To draw a circle, hold down the shift key and draw just as you did for the rectangle.  The shift key forces it to retain equal width and height.

  • How do I hide the background when I shape an image in 3D?

    This is a problem that has cropped up before but I'm going to simulate it.
    Say in this instance I want to overlay the picture of a kitten over a ball image. I've already extracted (roughly) the background from the kitten picture. I want to use 3D to warp it to the shape of a sphere but I've still got the ball's default background colour as well. How do I hide the background colour of the ball entirely so only the, warped, image of the kitten is visible to overlay over the ball image?
         When I wrap the kitten image onto a 3D sphere mesh preset I get the default background
         And when I try to overlay it over the 2D ball image the background prevents correct overlaying. I want just the kitten pic
    Thanks

    You apply the texture to the transparency of the material.
    Mylenium

  • I did a presentation with many images and animations, now I need to change only the images without modify the related animations. How can I do it?

    I did a presentation with many images and animations, now I need to change only the images without modify the related animations. How can I do it?
    I use Keynote 09

    Select the image you want to change and go to Format Menu>Advanced>Define as Media Placeholder (or command, option, control i).

  • I need help with the shape matching of this image

    I am currently using NI Vision Assisstant to help me with the logic for the VI code. So currently I have 3 diagonal rectangles and I cannot figure out how to find the shape of each of them. Attached is a screenshot of the image I have. I have it going through a Luminosity filter and then a frequency filter and then I converted it to a binary image... now I am at this point: If anyone could help me find the rectangles... that would be greatly appreciated. I am sorry for such a basic quesiton.
    Thank you,
    Yousuf M. Soliman
    Attachments:
    Test.png ‏19 KB

    Hello Yousuf,
    There are quite a few functions that you might find useful for locating rectangles in a binarized image.  Possibilities include Shape Matching, Pattern Matching, Geometric Matching, Shape Detection, and more.  The difficulty that you will run into is the fact that your retangles are not straight edged, but are also not curved edges.  Many of the shape matching tools look for straight edges and right angles, which are not present in your image.  As such, it may be easiest to first use edge detecting tools to locate your edges, then use measurement tools to calculate area or distance.
    I played around with your image briefly, and was able to localize the edges to within an approximation.  I used the Clamp (Rake) tool to achieve the edge localization seen in the attached screen shots.  As you can see in ClampRect.png, the edge lines drawn aren't terribly accurate, but the other images show the points used, and with some playing around you should be able to find a better approximation of the rectangle edge.  Hope this helps!
    Patrick
    CLA
    Attachments:
    ClampRect.PNG ‏47 KB
    ClampLongEdge.PNG ‏55 KB
    ClampShortEdge.PNG ‏47 KB

  • How do I modify the image size on OXO template HP

    the temporary site is "http://printtest2.businesscatalyst.com/"
    this is regarding what appears to be a "catalogue" presented on the homepage of the OXO template site. I want to modify the size of the images but can't find where the code is kept.
    When I'm in "design view" it looks like the content is being called by // {module_webapps,13325,a,}
    and when in "code view" it looks like its called by // {module_productfeaturelist,last,2,Default,,,true}
    Where can I view these pieces of code, or the module screens, and how do I modify the attributes?
    Is the {module_productfeaturelist,last,2,Default,,,true}, embedded in the {module_webapps,13325,a,} and if so, where can I go to see that?
    Thanks very much.
    Scott.

    something is changing the file size (dimensions), the actual dimensions are smaller than what is displayed.
    Can I modify the css through the BC admin interface, if so, where?
    I know this is newbie stuff, but I gotta start somewhere.
    Thanks.
    Scott.

  • Modifying the DisplayShelf sample to load images from a database

    Hi,
    I've been programming java for a couple of years but it's my first try at JavaFX and I feel completely lost.
    I am trying to modify the DisplayShelf sample to get image paths from a mysql database instead of loading the sample images in the jar.
    I created a class called ImagePaths with a single method called getPaths() that returns an array of String paths. I tested it and it works.
    Now following is the modification I did to DisplayShelf's class:
    I replaced the images array declaration with:
    var ip = new ImagePaths();
    var images = ip.getPaths();and later
    var shelf:DisplayShelf;
    shelf = DisplayShelf {
        spacing: 50
        scaleSmall: 0.7
        leftOffset: -110
        rightOffset: 110
        perspective: true
        content: bind for(i in images) {
            var item:Item = Item {
                angle: 45
                position: indexof i - half           
                image:Image{backgroundLoading: true, url:{i}}
                shelf: bind shelf
            item;
        }I replaced code based on intuition. Maybe I should have started with a hello world but please can you tell me what's wrong this code? I'm completely clueless.
    Regards,
    William.

    You code looks correct. If you print out the paths what do you get? What is the format of the paths?

  • Is this possible to access arbitrary frame and to modify the mask?..

    Sorry for a bit messy discussion title. Please, let me explain.
    I have some experience in implementing video processing algorithms, but as our own software and never under AE. Now there is an idea to implement something for AE and first of all, I'm curious, if this is possible at all.
    1) When processing the n-th frame, I need the full access to the data of (n-k)-th and (n+k)-th. Is this possible to do in general case? Or the only variant is to implement frames buffering during the first pass?
    2) Our algorithm uses the mask as one of the inputs. But in contrary to the usual case, mask does not define an area of interest. In any case the full frame is processed, but the processing differs for different regions, depending on mask. In our software, it works like this: user defines a mask (and some parameters). Then effect is slightly modifying (let say – refining) the mask during the render and renders final images. After this user can modify the mask somehow again if he/she is not satisfied with what algorithm has done. Can I produce the same workflow in AE? The only way is using a drawbot (this means CS 5.5 and higher)? And what if I want masks to be raster images?
    The second question in the framework of this one is how to do two video inputs for an effect (first – the video to be processed and second – the mask (grayscale sequence in general case))?
    The possible workflow is that user provides trivial mask – lets say, the black solid. But even during the first pass effect should produce the mask, according to its sight to the video – so, it should somehow substitute the black solid with the sequence on black'n'white images. Is this all possible in AE?
    3) Is this possible (should be, I guess) to implement multipass algorithms? How the preview works then, if I need, for example, to pass all the video length 3-4 times, to produce the final render?
    I can expect that all this is solvable in AE, but may be experienced users could be so kind to give me some basic recommendation on how to do this. Looking through the PDF, which accompanies the SDK has not allowed to come to a distinct answer for the question: is this possible or not. So, I rely on your consultation.

    hi Theofil Mulony, welcome to the forum!
    in short, yes, what you want to do is possible, but some parts may be tricky.
    and now the long version:
    1) When processing the n-th frame, I need the full access to the data of (n-k)-th and (n+k)-th. Is this possible to do in general case? Or the only variant is to implement frames buffering during the first pass?
    you can access the pixel data of any layer at times other than the currently processed time. this concept of getting that data is referred to as "layer checkout" in the AE SDK, and "wide time" is the name of getting pixel data at times other than the current.
    the following thread discusses the difference between two methods of getting such data:
    http://forums.adobe.com/message/4033930#4033930
    you can also look at the "checkout" sample project to see how both concepts are implemented.
    2) Our algorithm uses the mask as one of the inputs. But in contrary to the usual case, mask does not define an area of interest. In any case the full frame is processed, but the processing differs for different regions, depending on mask. In our software, it works like this: user defines a mask (and some parameters). Then effect is slightly modifying (let say – refining) the mask during the render and renders final images. After this user can modify the mask somehow again if he/she is not satisfied with what algorithm has done. Can I produce the same workflow in AE?
    masks in AE generate a matte by default. the user can turn that mask off, so that the shape remains, but the mask does not... mask. (you can also set the mask mode to "none" via API commands).
    you can then read the "off" mask attributes and either render using an API command (see "pathmaster" sample to see how), or write your own algorithm if the API constraints on that operation are a problem for you. (and there are a few constraints on rendering masks in the API)
    now. when you say "modifying the mask" do you mean you modify it's generated matte, or do you mean change it's defining vector?
    both are possible, but completely different.
    if you turned the mask off, and rendered it's alpha yourself, then you can modify that alpha as you wish.
    if you want to use AE's generated matte of the mask and change the mask's outline shape, then you need to look into "streams" and the "mask outline suite".
    the user can modify a mask's shape as he/she pleases, unless you lock that mask or otherwise sabotage the user's operation.
    The only way is using a drawbot (this means CS 5.5 and higher)?
    drawbot is the API for drawing over AE's interface in CS5 and up.
    it's only a drawing tool. previous versions used OS drawing tools. that's all the difference.
    what i think you're asking is weather you need to create the mask drawing/handling capabilities or not.
    the answer is: you can, but you don't have to.
    unless you need control over the mask drawing that AE's existing masks don't have, i would have used AE's masks and not create a brand new mechanism (that the user need to learn as well).
    if you insist at creating a custom UI for drawing masks, the "CCU" sample project would be a good place to start the research.
    (just don't come crying to me when you get a splitting head ache)
    And what if I want masks to be raster images?
    The second question in the framework of this one is how to do two video inputs for an effect (first – the video to be processed and second – the mask (grayscale sequence in general case))?
    The possible workflow is that user provides trivial mask – lets say, the black solid. But even during the first pass effect should produce the mask, according to its sight to the video – so, it should somehow substitute the black solid with the sequence on black'n'white images. Is this all possible in AE?
    by default, "effect" plugins (as opposed to AEGPs) get only one input - the image of the layer, post masks and previous effects (but before transformations).
    you can put as many "layer param"s in your effect and let the user select any number of other layers, which you can the "checkout" and use as second inputs.
    you can also checkout other layers without the user selecting them manually.
    however, checked out layer results are pre-masks and effects. so if the user draws a mask over a black solid, you will not be able to read the "post mask" image unless the user pre-composes the layer with the mask inside the pre-comp. it's a common practice for users to do so, as many effects rely on a second input, and that's the only way to make the input pos-masks and effects. (so it's no biggie from the user's point of view)
    in the same manner, you can read any layer's image and use it as a mask.
    you get the image buffer, so it's up to you to decide whether to use the alpha channel of that image or the rgb (or any other method you see fit).
    3) Is this possible (should be, I guess) to implement multipass algorithms? How the preview works then, if I need, for example, to pass all the video length 3-4 times, to produce the final render?
    AE doesn't do multi pass rendering.
    it actually can render arbitrary frames, in no particular order.
    but as you already saw, you can access the image data from any time - of any time, so you can emulate passes.
    if you need to fly through the whole sequence for every frame, that would of course be very time consuming and wasteful.
    in such a case, you can try to do these passes only once, when effect is implemented, and cache the results.
    look up "sequence data", to see how to manage memory specific to a single instance fo you effect.
    but i must say that if you have to do full length scans of the footage, a couple of times over, and cache EVERYTHING, then you're in a bit of a problem in AE.
    it's just not set up for such rendering logic.
    not impossible, but highly inefficient in the AE rendering pipeline.
    there is a lot more to al of the above, but i hope this gave you a clearer picture of how things are in AE.

  • Is it possible to transform a Paint but not the Shape it fills?

    Is it possible to apply a transform (i.e., AffineTransform) to the Paint that is used to fill a Shape, without applying the transform to the Shape itself? I don't see a way to do that.
    I.e., when the Graphics2D transform is modified, it applies to both the Shape being filled and to the Paint that fills it. I would like a way of leaving the Shape alone, while still rotating or scaling the Paint effect within it.
    Thanks for any ideas!

    You do the transform on an image, then clip that according to the shape, then use that clip for the fill, or make a mask of the shape and have a transparency for the shape--over lay that onto your image that has been transformed. In any case you have to have discrete objects--an image and a shape, not an image with a shape in it already.

  • I can see my thumbnails for my events in iphoto, but when I click to open the folder, no photos show up. However, when I hover over the thumbnail, it shows the flicker of images that should be inside the folder, as well as

    I can see my thumbnails for my events in iphoto, but when I click to open the folder, no photos show up. However, when I hover over the thumbnail, it shows the flicker of images
    that should be inside the folder, as well as # of images in each folder. It also occasionally says the following when I try to even open iphoto:  "Your photo library will not be readable by previous versions of iPhoto after the upgrade. The upgrade process for very large libraries may take an hour or more to complete." So, I am scared to hit "upgrade" for fear I will never recover any of the images as the wording in this quote seems odd. The photos are not in the trash. Did I lose them all? Do you know if/how I can retrieve them?

    iPhoto 08?
    Try these in order - from best option on down...
    1. Do you have an up-to-date back up? If so, try copy the library6.iphoto file from the back up to the iPhoto Library (Right Click -> Show Package Contents) allowing it to overwrite the damaged file.
    2. Download iPhoto Library Manager and use its rebuild function. (In Library Manager it's the FIle -> Rebuild command)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. 
    3. If neither of these work then you'll need to create and populate a new library.
    To create and populate a new *iPhoto 08* library:
    Note this will give you a working library with the same Events and pictures as before, however, you will lose your albums, keywords, modified versions, books, calendars etc.
    In the iPhoto Preferences -> Events Uncheck the box at 'Imported Items from the Finder'
    Move the iPhoto Library to the desktop
    Launch iPhoto. It will ask if you wish to create a new Library. Say Yes.
    Go into the iPhoto Library (Right Click -> Show Package Contents) on your desktop and find the Originals folder. From the Originals folder drag the individual Event Folders to the iPhoto Window and it will recreate them in the new library.
    When you're sure all is well you can delete the iPhoto Library on your desktop.
    In the future, in addition to your usual back up routine, you might like to make a copy of the library6.iPhoto file whenever you have made changes to the library as protection against database corruption.

  • How can i change the title and image of  published exe

    Hi ,
    I have published a fla file in exe format .
    how can i change the title and image of this exe? do I ve to
    use some of the available softwares in the market? cant i do the
    customised setting in the flash player itself?

    On Fri, 4 Apr 2008 06:21:15 +0000 (UTC), "mFlexDev"
    <[email protected]> wrote:
    > I have published a fla file in exe format .
    > how can i change the title and image of this exe?
    I beleave the easiest way is to use PEResourceExplorer,
    Resource
    Hacker or similar software to modify EXE resources, such as
    window
    title and window icon.

Maybe you are looking for

  • Gmail calendar sync is available why not hotmail calendar

    Why s that you can sync to a gmail calendar but not to a hotmail account calendar. Post relates to: None

  • Scan a document to adobe reader

    how do I scan a document to adobe reader

  • Which Companion Version for WebCenter Extensions in JDeveloper 11.1.1.5

    My firm is using SOA Suite 11.1.1.5 for a variety of services which requires JDeveloper Studio 11.1.1.5. However, my firm also develops applications using ADF / WebCenter (currently 11.1.1.4, soon to be 11.1.1.6). While trying to experiment with a si

  • Cannot launch V cast Media Manager after install

    Windows XP, SP3 Just installed the program (and uninstalled, and reinstalled 3x's with and w/o security programs enabled). Upon the finish of the install is a "Launch" button. When clicked, the program launches, a tutorial screen pops up, and freezes

  • Soap service

    hi , Can anybody help me to answer the following questions. 1.How to find out SOAP Service is active?(i am unable to find in SICF,any other ideas) 2.How to call  SOAP RFC service to push data into the delta queue in SAP BW? (any body can tell me the