Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to test the efficiency of Java ImageIO image merging

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces how to test the efficiency of Java ImageIO image merging. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

Through the pure Java way to add a small picture (layout) to a bottom map (map), it is found that the effect is not ideal.

What is the pure java method? That is to say, these operations do not need to rely on the cCompact + library, have a good cross-platform, and can not only run on Windows, Linux, Unix platforms, but also can be used as mobile platforms such as Android.

Here is the data from the test of adding a small picture (that is, image merging) to a base image:

Number of merged Mini Images

Number of tests

100 (Zhang)

1000 (Zhang)

10000 (Zhang)

Time consuming (milliseconds)

The first time

2003

15334

153010

The second time

1792

15200

153340

The third time

1869

15236

152673

The fourth time

1747

15903

154978

The fifth time

1871

16028

156506

The sixth time

1793

15545

154854

Average time (milliseconds)

1845.833

15541

154226.8

Converted to seconds

1.845833

15.541

154.2268

It takes an average of 1.845833 seconds to merge 100 small images onto one base image.

Merging 1000 small images onto a base image takes an average of 15.541 seconds.

Merging 10000 small images onto a base image takes an average of 154.2268 seconds.

It feels that this kind of efficiency is still too low to meet the needs of tens of thousands of base maps. It is said that it takes about a second or two for an efficient C++ program to complete tens of thousands of map layout tasks (according to an experienced expert, I have not tried).

This time I finally feel the gap in efficiency between java and CMG.

So is it time to sacrifice cross-platform and try it with Jmagick? This question needs to be discussed.

Jmagick attempts to merge images, using the command of ImageMagick to invoke the command to merge images.

Public void compositeImageList (List additionImageList,String srcImagePath,String toImagePath) {/ * * Command format: composite-geometry + 100room150 additionImagePath srcImagePath toImagePath * append the image additionImagePath to the 100150 coordinates on the image srcImagePath and output it to the toImagePath image * / String command = "composite-geometry + 100room150 D:/test/fileSource/007.png D:/test/fileSource/002.jpg D:/test/desk/rose-002.png" If (additionImageListabilistic null) {System.out.println (additionImageList.size ()); for (int iTune0witi)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report