|
|
View previous topic
::
View next topic
|
Author |
Message |
ramon fincken Site's programmer
 Get a free globally recognized avatar It's free!
Joined: 03 Aug 2007 Posts: 414 Location: A'dam/Diemen, The Netherlands
|
Posted: Fri Dec 02, 2011 12:59 pm Post subject: [imagej] Commandline resize image |
|
|
resize an image and write the result as PNG
Code: | /**
* @author Ramon Fincken, http://www.ramonfincken.com/permalink/topic241.html
* @param source
* @param write_to_png
* @param width_factor
* @param height_factor
*/
public void resize_by(String source, String write_to_png, double width_factor, double height_factor)
{
ImagePlus imp1 = IJ.openImage(source);
ImageProcessor ip=imp1.getProcessor();
int new_width = (int)(ip.getWidth() * width_factor);
int new_height = (int)(ip.getHeight() * height_factor);
ip = ip.resize(new_width, new_height);
imp1.setProcessor(ip);
WindowManager.setTempCurrentImage(imp1);
IJ.saveAs("PNG", write_to_png);
} |
|
|
Back to top |
|
 |
Google adsense Advertisement
|
Posted: Fri Dec 02, 2011 12:59 pm Post subject: [imagej] Commandline resize image |
|
|
Advertisement
|
|
Back to top |
|
 |
GravityForms Advertisement
|
Posted: Fri Dec 02, 2011 12:59 pm Post subject: [imagej] Commandline resize image |
|
|
Advertisement
 |
|
Back to top |
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|