`
喜马拉雅上的小草
  • 浏览: 50452 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Changing The Size Of An Image

 
阅读更多
Changing The Size Of An Image

Changing The Size Of An Image.
First off, I would just like to say that i�m a French Canadian student so my English is not very good, and that I�m not an expert in JMagick so this might not be the best way to do it. If there is a better way your welcome to send it to me and I will make correction to this document.
One very useful feature of ImageMagick is to be able to resize images. This function is great for creating thumbnails or for making full screen images. It might seem a little complex at first but manipulating images with JMagick is a very simple and powerful thing.
Step 1: Reading The Picture Files

      ImageInfo info = new ImageInfo();
      MagickImage image = new MagickImage( new ImageInfo( "testpic.jpg" ) );

For more information on reading pictures look at the previous tutorials.
Step 2: Resizing

      MagickImage bigger = image.scaleImage(1200, 900);

As you can see this is pretty straightforward, you use your already existing instance of

 MagickImage that we named image use the scaleImage method with the desired width(1200)

and height(900). The method returns a MagickImage object witch is the new resized image.
Step 3: Writing the new file

      bigger.setFileName("bigger.jpg");
      bigger.writeImage(info);

All that is left to do is to create a new file in this case its called bigger.jpg but we could have also overwritten testpic.jpg

分享到:
评论

相关推荐

    EEUPDATE刷MAC工具 EEUPDATE v5.30.10.00

    the <addrfile> without changing the rest of the EEPROM. /D <imagefile> or /DATA <imagefile> Programs the NVM [EEPROM/FLASH] with the contents of <imagefile> without changing the MAC address. /...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - ADD: In TFlexPanel.DefaultLinkPoint property added Size field that lets define visual size of the connection points of the flex-connectors. Initialized with DefaultLinkPointSize constant in the ...

    CCD_descript

    The signal output from the CCD needs to be processed and amplified appropriately to maximize the signal-to-noise ratio and ensure accurate representation of the captured image. **3.5 Light Source** ...

    CImg Reference

    - **Resizing:** Methods like `resize()` allow changing the dimensions of an image. - **Filtering:** Various filters such as blurring, sharpening, and edge detection are available. - **Color Space ...

    NewSID(光学习一下代码就可以了,没看清楚介绍别运行)

    which typically means that you must be logged in as a domain administrator to use this feature.Note that when you run NewSID that the size of the Registry will grow, so make sure that the maximum ...

    Mastering_Perl_Tk_1st_ed_2002.pdf

    **4.13 Changing the Size of a Button** Instructions for resizing buttons, including adjusting width and height, are provided. **4.14 Adding a Keyboard Mapping** Methods for associating keyboard ...

    squashfs2.2-r2.tar.gz

    entry will be the basename of the source path. If more than one source entry maps to the same name, the conflicts are named xxx_1, xxx_2, etc. where xxx is the original name. To make this clear, take...

    BURNINTEST--硬件检测工具

    - Updated the detection of Hyperthreading and the number of logical CPUs for a new Intel CPU. Release 5.3 build 1025 WIN32 release 11 July 2008 - Corrected a Disk test bug where on rare occasions a...

    S7A驱动720版本

    This parameter defines the maximum address gap between an existing and a new block at which the driver automatically appends the new block to the existing. If the address gap is greater, then the ...

    VB编程资源大全(英文源码 API)

    <END><br>22 , api.zip api function collection<END><br>23 , benchmark.zip This program is very usefull program which gets the details of your computer and have an ability of changing some system...

    Delphi2010皮肤控件AlphaControls6.21FS

    * Improved support of Devexpress Grids (Quantum and Pivot), Scheduler and many other controls which have the LookAndFeel property (patching of DevEx sources is not required anymore! Just install ...

    Professional.MFC.with.VC6

    The Size of It All Activation The Edit Menu OLE and the Clipboard Copying and Cutting OLE Objects Links Drag-and-drop Getting Started with Drag-and-drop Take a Drag On the Clipboard ...

    BobBuilder_app

    In the event of page getting full and reaching the PageItemCount, MGIndex will sort the keys in the page's dictionary and split the data in two pages ( similar to a b+tree split) and update the page ...

    Senfore_DragDrop_v4.1

    Since all demos were developed with the latest version of Delphi, most of the demo forms probably contains references to properties that doesn't exist in earlier versions of Delphi and C++ Builder. ...

    一本android的好书beginning android 2 和 源码

    And Now, the Rest of the Story What You Get Out of It Inside the Manifest In the Beginning, There Was the Root, And It Was Good Permissions, Instrumentations, and Applications (Oh My!) Your ...

    DevExpress VCL 13.2.5 D7-DXE6 FullSource

    •S173677 - Documentation - Add a note that resizing an alert window via the standard window size API (properties or methods inherited from TdxAlertWindow ancestor classes) is not recommended ...

    edjpgcom|图片中插入一句话

    data from the original file, the new comment, and the rest of the original file to this temporary file. It closes the temp file and attempts to rename the original file to ".bak". If this succeeds, it...

    cuteEditor6.0

    <br/>学习应用Web标准有很多益处,下面给几个简单例子: <br/>获得好的搜索引擎排名: The separation of content and presentation makes the content represent a larger part of the total file size....

    VB编程资源大全(英文源码 控制)

    The analog click itself is very accurate and looks very impressive.<END><br>41 , edge.zip This program uses a few API calls/functions to set 3D, sunken and etched effects to an image inside an ...

    RxLib控件包内含RxGIF,全部源码及DEMO

    users with an easy means of changing the current display order of data being retrieved from an indexed table. When the user selects the TDBIndexCombo component, it's drop-down selection list is ...

Global site tag (gtag.js) - Google Analytics