Resize the image in the textpane

Does anybody know how to resize the image in the textpane to fit the size of the textpane. I am trying to avoid scrolling. Any suggestions?

Here is my code,
JTextPane tp = new JTextPane();
URL msn = new URL("http://www.msn.com");
tp.setPage(msn);
I am trying to make the webpage, which is returned by the URL, fit into the JTextPane without implementing scrolling. I would like to resize the webpage to fit into the JTextPane regardless of the size. Any suggestions? Thanks.

Similar Messages

  • Using Javascript & Actions to resize an image and add the filename as text

    Hello,
    I am currently working on a way to take an image, resize it and add exactly what is in it's file name (before extension) as a text layer. I have succeded in this BUT am having issues with file names that require more than one line of text.
    I need the text to align to the bottom of the image & the script or action must then resize the image so that the text does not overlap.
    Any ideas on how this can be done?
    At the moment I am using:
    -"Fit Image.jsx" to resize my image to a specific size (This was included in the Photoshop CS5 scripts)
    - A script to add the file name without extension and place the file name at a specific position.
    AdFileName.jsx
    if ( documents.length > 0 )
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PIXELS;
    try
      var docRef = activeDocument;
      // Now create a text layer at the front
      var myLayerRef = docRef.artLayers.add();
      myLayerRef.kind = LayerKind.TEXT;
      myLayerRef.name = "Filename";
      var myTextRef = myLayerRef.textItem;
      // strip the extension off
      var fileNameNoExtension = docRef.name;
      fileNameNoExtension = fileNameNoExtension.split( "." );
      if ( fileNameNoExtension.length > 1 ) {
       fileNameNoExtension.length--;
      fileNameNoExtension = fileNameNoExtension.join(".");
      myTextRef.contents = fileNameNoExtension;
      // off set the text to be in the middle
      myTextRef.position = new Array( docRef.width / 2, docRef.height / 2 );
      myTextRef.size = 12;
            myTextRef.font="Arial-BoldMT"
            //set position of text
            myTextRef.justification = Justification.CENTER;
            myTextRef.kind = TextType.PARAGRAPHTEXT;
            myTextRef.width= docRef.width;
            myTextRef.height= docRef.height/ 2;
            myTextRef.position= [0, docRef.height * 0.88];
    catch( e )
      // An error occurred. Restore ruler units, then propagate the error back
      // to the user
      preferences.rulerUnits = originalRulerUnits;
      throw e;
    // Everything went Ok. Restore ruler units
    preferences.rulerUnits = originalRulerUnits;
    else
    alert( "You must have a document open to add the filename!" );
    Can the position be changed to allow more rows of text but keep it aligned with the bottom of the layer?
    How can I script in a way to make the image resize based on the amount of text lines?
    Any help would be greatly appreciated.

    You can add a text layer any where the only thing you need to worry about is the size of the font you use.  You can normally calculate a font size by saving the images resoltuion and then setting its resolution to 72 DPI calculate a font size basied of the images pixel width and the number of characters you want in a line. After adding the text layer you can restore the image to its original resolution and align the text layer by making a selection and alignint the text layer to the selection.  There are nine posibilites like the positions in the selection you can align to like a tick tack toe board. You need to use a script to add the text layer because your retrieving the filename.  The positioning of the text layer could be done easily in an action the would use the scriot to add a text layer the do a select all  the align the added text layer to the selection.
    About your script don't make text paragraph just add new line characters to make a multi line text layer So it can be positioned easily
    I do just that with my stampexif action.  The action uses my stampexif Photoshop java script to add a multi line text layer containing some formatted EXIF data then the action centers the text layer and add a layer style to it. Link http://www.mouseprints.net/old/dpr/StampExif.jsx Example

  • Photoshop CC: Have a template that I moved image into.  Image is too small.  How do I resize the image while in the template?  Or must I go to original image file and resize there again and again until I get the right fit?

    I have a template that I am able to plug different pictures into at different times.  The problem is that when I plug an image into that template, I find that the image is either too big or too small.  Is there a way to plug the image into the template and resize the image (and not the template itself) OR will I have to go to the file with the original image and resize it there and then try to plug it in to the template to see if it fits------and if it does not fit, go back to the original file with the image and resize it again and see if that fits---and so on and so on...........?  I have tried the" image size" option but it's hit or miss------mostly miss!
    Thanks!

    Read up on Smart Objects. It looks like you have no idea as to how to create and use them.
    Jut create a Smart Object from the layer containing whatever it image it is that you are "plugging into your template".  But you do need to learn the application at its most basic levels.
    Photoshop is a professional level application that makes no apologies for its very long and steep learning curve.  You cannot learn Photoshop in a forum, one question at a time.
    Or is it possible that you don't even have Photoshop proper but the stripped-down Photoshop Elements?"
    If the latter is the case, you're in the wrong forum.  This is not the Elements forum.
    Here's the link to the forum you would want if you're working in Elements.:
    https://forums.adobe.com/community/photoshop_elements/content
    If you do have Photoshop proper, please provide the exact version number of that application and of your OS.
    (edited for clarification)

  • I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated.

    I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated. Heres an image of before and after. The first image I use is a JPG 72dpi 1500px x1500px and I want to downsize it to 600x600px same res, but it keeps pixelating, this has never happened before. Any suggestions, thoughts?
    thanks!

    I wouldn't say pixelated; more like blurry.
    Like ConnectedCreative said, what steps are you using? Are you using "bicubic sharper" when resizing down?

  • How do I resize an image within a drop zone (not the drop zone itself) in motion 5?

    How do I resize an image within a drop zone (not the drop zone itself) in motion 5?

    I think others would be able to help if you describe a little more why you'd like to do this. Given that drop zones are a way of passing images into Motion that you want to manipulate, resizing a drop zone is the equivalent of resizing the image.
    If you're having a problem with an image from Final Cut being too big or too small, select the Drop Zone in the inspector and make sure the Fit parameter is set to 'Fit' - 'Center' will result in images dropped not being scaled to fit the Drop Zone. 'Stretch' will force the dropped image to fill the space defined by the drop zone,
    If the image is already cropped and scaled up in Final Cut Pro, that is the information that Motion gets - you can't scale down the image to see more of the edges that have been cropped off.
    If you want more than one copy of the image passed via the drop zone, use Make Clone Layer from the Object menu.

  • Drag and Drop into Photoshop layer without resizing the source image

    Hello,
    I am using Photoshop CS5, 64bit, in Windows 7.
    I went through following steps and getting result that I do not want:
    1. Open an existing photopshop file.
    2. From the explorer window of my folder, select 100 png files and drag into the graphics area of the open photoshop image.
    Result: Photoshop resizes the png file and place it as a layer. It also asks me to commit the resizing for each individual file that I dragged and drop. Sometimes, it takes it as 100% scale, sometimes, 98%, sometimes 102%. If I change it to 100%, then it is not the original size. The image become larger and blurry.
    Expected Result: Place 200 png files as separate layer of the open photopshop without resizing it.
    My png files are icons that don't need resizing. I cannot tweak 200 images just to get this to the original dimension!
    Other things I tried:
    I turned off the "Preference->General->Resize Image During Place". I also turned off "Place or Drag Raster Images as Smart Objects".
    I still get the same result. I need nothing smart here. Just let me place images without any smart stuff!
    I also went to help and googled. I could not find what I need.
    Thank you!

    That works!!
    Thank you!

  • Resizing the images

    hi,
    i want to resize and centering external images.
    i have done with centering the images.
    but how to do resizing.....here is my code....
    // code for centering images starts
    //Define center coordinates
    var centerX:Number = _root.emptymc_mc.imagemc_mc._width / 2;
    var centerY:Number = _root.emptymc_mc.imagemc_mc._height / 2;
    var movieClipLoader:MovieClipLoader = new MovieClipLoader();
    var loaderListener:Object = new Object();
    //Use the onLoadInit function to get the loaded images
    proportions
    loaderListener.onLoadInit = function(target:MovieClip) {
    trace(target._width + " x " + target._height)
    target._parent._x = centerX - target._width / 2;
    target._parent._y = centerY - target._height / 2;
    // end resizing and centerring code
    // now loading images into movie clip loader
    movieClipLoader.addListener(loaderListener);
    var movieClipHolder:MovieClip =
    _root.emptymc_mc.imagemc_mc.createEmptyMovieClip(" container",
    getNextHighestDepth());
    var movieClipLoaderTarget:MovieClip =
    movieClipHolder.createEmptyMovieClip("loader", 1);
    //Load an image to the target
    movieClipLoader.loadClip(_parent._parent.thumbs.fi
    rstChild.childNodes[2].childNodes
    .childNodes[0].nodeValue, movieClipLoaderTarget);
    // end
    now how to resize the images???

    Thanks for the reply...
    now its resizing and centering the images well but not
    according to the aspect ratio.
    see... i have one mc called imagemc_mc in which i want to
    load the images.
    so first i grab the width and height of the imagemc_mc in a
    varibale.
    var imgwidth = _root.emptymc_mc.imagemc_mc._width;
    var imgheight = _root.emptymc_mc.imagemc_mc._height;
    and then in onLoadInit() method first its check the width and
    height of the target and is it is greater than imagemc_mc then it
    resize the image to the imagemc_mc 's width and height.
    if(target._width > imgwidth && target._height >
    imgheight)
    target._width = imgwidth;
    target._height = imgheight;
    else
    target._parent._x = centerX - target._width / 2;
    target._parent._y = centerY - target._height / 2;
    target._parent._x = centerX - target._width / 2;
    target._parent._y = centerY - target._height / 2;
    its working ....but if image is greater than imagemc_mc then
    the image is squeezing ....it is not according to the aspect ratio.
    please reply..............
    thanks a looooooooot

  • How resize the image after drag drop according to container

    Hi,
    I have a image which can be drag drop in different size of containers. After drop i want to resize the image by maintaining the aspect ratio according to the container in which it is going to be drop. I will be very thankful for your help.

    thank you, brother
    i will try it see if it is work
    whatever, i will report the result later

  • In Aperture 3 creating a book using Formal theme and in Edit Layout I can move but not resize the image box even though handles appear and the manual says I should be able to. Help      image boxt

    Can I resize image boxes with the displayed handles as the User Manual suggests I can, when creating a book in Aperture 3 using the Formal Theme (with the beveled mask) and in Edit Layout mode?  I can move the box with the yellow guidelines, but those handles will not move to allow me to adjust size.  If I delete the box and add a photobox, I can resize, but I loose those nice beveled masks!

    Well I tried on my wife's MB and it worked fine, but keeps the same aspect ratio. Nearly there. I tried the local Apple outlet, but they had just taken Aperture off the demo machine .
    However, I have discovered that I can use the "right click" option for 'photo aspect ratio' and it will resize the box to accomodate my pictures.  By fiddling I can select an alternative ratio and/or picture and change the size of the frame up or down and try to get an appropriate size and ratio, e.g. if I have a small landscape picture, I can pop in a bigger square picture (it gets cropped) then choose a portrait mode (cropped differently) then pop in my landscape picture (still cropped, but bigger size), then use the option 'photo aspect ratio', I get it uncropped and bigger.  Not a really satisfactory work around, but better than nothing. 
    By combining they fiddling with aspect ratios and the pinch/squeeze routine - on the MB (or via Lion and a track pad I assume) - I should get there.
    Pity those pesky handles don't work!!
    Thanks folks for the help

  • How can I resize an image without losing resolution or using the crop tool? I am using Photoshop Elements 13 on a PC.

    How can I resize an image without losing resolution or using the crop tool? I am using Photoshop Elements 13 on a PC.

    Hi Peru Bob,
    I've tried two images, the results were:
    Image 1
    Jpg, original file size 923KB, dimensions 848px x 279px.
    After resizing to 848px x 180px with 72dpi, the file size decreased to 164KB.
    Image 2
    Jpg, original file size 809KB, dimensions 1200px x 1800px.
    After resizing to 668px x 722px with 72dpi, the file size decreased to 307KB.
    So, there seems to be a fair file size loss - is this to be expected?

  • I updated to Photoshop cc 2014 and now can't resize the images like I used to.

    I updated to Photoshop cc 2014 and now can't resize the images like I used to. 
    I used to click on the image and then go to the corner hold down shift and resize it.  Now it won't do it.
    How do I do it now? 
    I have a project deadline and need to do this asap.  Panicking that I won't meet my deadline.

    Did you turn off the "show transform controls" option in the move tool?
    It sounds like you were using that previously.
    And you can always transform by using the Free Transform command (command/control T).

  • I want resize the image and set position after retrieving from oracle datab

    How can I display image on web page after retrieving it from oracle database. Display is not problem but resize that image and position is very dificult .Please send me Guideline about blob object todisplay and resize it in web pages

    I tried to do the suggetion made by you but I was not able to solve the issue. I think I am close to it and with your help I should be able to resolve it. Let me explain you the brief about this issue.
    1. Another group uses Oracle Apex to load the images in to the database.
    2. I am fetching this data fron Oracle and displays in to Webpage using PHP.
    This is so far I tried. Please bear with me if I am doing anything wrong.
    1.I created program.php which calls the <IMG> as suggested by you.Snippet of the code is
    <div><img src="/oracle/image_story.php" alt="Image Stories" width="900" height="500" /></div>
    2. In the image_story.php, I used the following code.
    <?php
    $query = "SELECT *
              FROM IMAGE_STORY WHERE image_id = 50";
    if ($result = run_oracle($query, 'select')) { // Run the query.
         $num_results = count($result);
         if ($num_results > 0) {
         foreach($result as $row){
              $img = $row['DOCUMT']->load();
              header("Content-type: image/pjpeg");
              echo $img;
              //echo '<div><img src="'.$img.'" alt="Image Stories" width="900" height="500" /></div>';
    ?>
    When I run the program.php,Image is not displayed and it is showing as "X". To troubleshoot the issue,I run the image_story.php and echo $img is giving me the weird character like,
    "ÿØÿàJFIFddÿìDuckyPÿîAdobedÀÿÛ„          
    I used PL/SQL developer as a client to access the BLOB field from the database and in the HTML view, it is giving me the same output.
    Select * from image_story a where a.image_id = 50
    I am not sure the issue is with the MIME-TYPE,ENCODING or I am missing something here. I tried lot of Content-Type.
    Please guide me.

  • How do I resize an image on the photo layer?

    I am trying to resize an imported image to fit in with my current shapes. Is there a way to do this? I have tried pinching the image on the screen but to no avail.

    You have to resize the whole layer. Tap the three dots on the right of the layer in the Layers panel. Then tap the cross on the left of that menu. You can then pinch to resize the layer

  • How can to resize an image uploaded in to the smart image

    Hi
        I have an image uploaded into the smartimage from the local file system. How can i resize this file or create a rendition for this image?
    Thanks
    Veena

    Hi
       I got a reference for the same question from Stack Overflow http://stackoverflow.com/questions/14726485/resize-an-image-resource-in-cq5/16728970#16728 970
    I tried the same method
    Resource resourceNew = resource.getResourceResolver().getResource(img.getFileReference());
        Asset asset = resourceNew.adaptTo(Asset.class);
        log.error("asset ****" + asset);
        Layer layer = new Layer(asset.getOriginal().getStream());
        layer.resize(200, 200);
        log.error("layer ****" + layer);
                            Image image = new Image(resource);
        String mimeType = image.getMimeType();
        ByteArrayOutputStream bout = null;
        ByteArrayInputStream bin = null;
        try {
            bout = new ByteArrayOutputStream(2048);
            layer.write(mimeType, 1, bout);
            bin = new ByteArrayInputStream(bout.toByteArray());
            asset.addRendition("resizedImage", bin, mimeType);
    log.error("asset Bin" + asset);
        } finally {
            // close streams ...              
    Where img is my Image object and I was able to create a rendition in the dam.
    But the rendition I am getting is in File format. Is there a way by which i can change it to png format??? any Help will be appreciable..
    Thanks
    Veena

  • Resize theb image in the Tab Bar and Table View

    Hi,
    I have image of 64x64.
    I want to resize the image to fit it into Table View and also in the Tabbar.
    I don't want to provide separate images for each.
    Is it possible?

    The mozilla.widget.render-mode preference works in beta 6, but this preference has now been removed from the latest development builds and will not work in beta 7 or later.
    Removed by the part 2 patch for [https://bugzilla.mozilla.org/show_bug.cgi?id=596494 Bug 596494] – Update render mode on device removal

Maybe you are looking for

  • Time to upgrade:  Long time Apple user, get the Iphone 4 or Droid 3???

    Hello, It's time to upgrade to a new phone for both me and the wife, she needs a new phone now as her LG env3 is acting up.  I'm a looong time Apple user, and of course the Apple iphone is a natural to pick, however It'll cost $350 for 2 when we use

  • Error in CRM WEB UI : Item category could not be determined.

    Hi, I am trying to create Service Confirmation. I got an error sayin for line item 20: Item category could not be determined. Conversion Factors are invalid. Can you please tell me, when such type of error comes? Do we need to check any configuration

  • Picture on TV appears black & white

    I have successfully connected my Toshiba laptop to my TV using the TV out (S-Video) connection to SCART. I have now purchased a new TV which is HD LCD but upon connection the screen is black & white. I have searched everywhere and tried any possible

  • Need to isolate error with output with valid input (code included)

    Hey guys, this code will be a bit lengthy as I am posting from two separate Java files: Rectangle.java and RectangleTest.java - Basically I am stumped as to why even valid input keeps resulting in this message: System.out.println("\nThis is a SQUARE,

  • Where to set up connection to Adapter Engine (central)?

    Hi guys! I need to change connection (server:port) settings to central adapter engine, because I get error (in RWB->Component monitoring->AdapterEngine): Unable to establish connection to "http://<servername>:<port>/AdapterFramework/rtc" Thank you! O