Im4java in java

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
neiyo7
Posts: 2
Joined: 2018-12-08T08:19:51-07:00
Authentication code: 1152

Im4java in java

Post by neiyo7 »

Code: Select all

public static boolean zoomImage(String srcImagePath, String newImagePath, Integer width, Integer height, int qual)
	{
		try
		{
			IMOperation op = new IMOperation();
			op.thumbnail(width, height);
			op.gravity("center");
			op.background("white");
			op.depth(8);//No effect!!
			op.extent(width, height);
			op.quality((double) qual);
			op.addImage(srcImagePath);
			op.addImage(newImagePath);
			ImageCommand convert = getImageCommand(CommandType.convert);
			convert.run(op);
			System.out.println("OK");
		}
		catch (Exception e)
		{
			e.printStackTrace();
			return false;
		}
		return true;
	}

this line "op.depth(8);//No effect!!" It' not work!, the image always "depth:24 ", How can I change it? help me
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Im4java in java

Post by snibgo »

Im IM, "depth" means "pixels per channel per pixel". In some other programs, it means "total bits per pixel".
snibgo's IM pages: im.snibgo.com
neiyo7
Posts: 2
Joined: 2018-12-08T08:19:51-07:00
Authentication code: 1152

Re: Im4java in java

Post by neiyo7 »

I know that, I want to change the depth 24 to 8 , reduce image size.
It's also a way to adjust the quality. I want to see if there are other ways to solve this problem.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Im4java in java

Post by snibgo »

"depth(8)" will reduce the image to 8 bits/channel/pixel. Perhaps you want "-type Palette". Some other function will do that. Sorry, I don't know IM for Java.
snibgo's IM pages: im.snibgo.com
Post Reply