Home  >  Q&A  >  body text

c++ - 怎样快速为10亿张1024*1024的图片整体生成一张1024*1024的缩略图?

有10亿张10241024的png图片,现在需要生成它们整体的一张10241024的缩略图,也就是说,需要在逻辑上将它们拼接起来再生成一张缩略图,有什么高效的好方法吗?尝试了一下ImageMagick,100张图片就耗时很久,有没有什么快速的好方法?谢谢!

阿神阿神2764 days ago975

reply all(9)I'll reply

  • 迷茫

    迷茫2017-04-17 15:25:12

    1024*1024 = 1,048,576
    1 billion pictures is 1000,000,000
    Each pixel corresponds to about 1000 pictures. You can use the sampling method. Each pixel randomly selects N pictures from 1000 pictures. , then randomly select M pixels in each picture, obtain the average value as a pixel of the thumbnail, and obtain 1024*1024 pixels of the thumbnail in turn.
    Can be implemented using opencv.
    However, if these 1 billion pictures are random, the result will be close to a picture with a grayscale of 0.5. Because according to the central limit theorem, the variance of each pixel of the thumbnail tends to 0. You have to ensure that the combination of 1 billion pixels has structural characteristics.

    reply
    0
  • PHPz

    PHPz2017-04-17 15:25:12

    Open PS and draw a picture directly with maximum efficiency

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 15:25:12

    Again, Alibaba Cloud OSS comes with image processing functions. You can take a look at the API.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:25:12

    Data compression will calculate the pixel size of each image on the final image, then compress 1 billion images to the corresponding size, and finally call ImageMagick for splicing

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 15:25:12

    I’m not sure about the principle of the thumbnail generation algorithm, or can you see if you can parallelize the algorithm and do it in a distributed way?

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 15:25:12

    Why is there such a demand? 100,000 such small pictures cannot take up even one pixel in each picture, right?

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 15:25:12

    It feels like the memory will fail

    reply
    0
  • 黄舟

    黄舟2017-04-17 15:25:12

    1 billion, what is the concept? It’s big data, right?

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 15:25:12

    1 billion pictures! ! I want it fast! ! Looking for solutions

    reply
    0
  • Cancelreply