ghprogrammingco 0 Newbie Poster

I should write a program to combine the huge number of images side-by-side. The source images are jpeg and png formats images. I think no any direct way to combine png or jpeg images to gather, unless first convert them to bmp, or any raw format, and perform combination and finally convert the new image to jpeg or png format. Because of huge count of images (about 100000 images), I cant use standard available tools, that uses main memory. I should make all of operations on hard disk. Then I should write entire needing code. I need any information about these formats and similar codes if exists. The programming languages not important, because, I worked with C#, java, c, c++, vb6, vb.net.
here I give you my code (that perform such task) as sample in matlab:

function [bOperationSuccessfullyCompleted] = JpegImagesMerge(mapsPath,baseX,baseY,baseZ,wLen,hLen,TargetFile)
    bOperationSuccessfullyCompleted = true;
    finalMap = uint8(zeros(hLen*256,wLen*256,3));
    for i=1:hLen
        Y=baseY+i-1; % minus one exist because of i=1 in first step.
        for j=1:wLen
            X=baseX+j-1; % minus one exist because of j=1 in first step.
            mapFileName = strcat(mapsPath,'\','v=46&x=',int2str(X),'&y=',int2str(Y),'&z=',int2str(baseZ),'.jpg');
            if exist(mapFileName,'file')
                mapFile = imread(mapFileName,'jpg');
                [szx,szy,szz] = size(mapFile);
                if szx~=256 || szy~=256
                    bOperationSuccessfullyCompleted = false;
                    break;
                end              
                bx = ((j-1) *256+1);
                by = ((i-1) *256+1);
                finalMap(by:(by+255),bx:(bx+255),:) = mapFile;
            else
                bOperationSuccessfullyCompleted = false;
                break;
            end
        end
        if bOperationSuccessfullyCompleted==false
            break;
        else            
            imwrite(finalMap,TargetFile,'jpg');
        end
    end
end

JpegImagesMerge('D:\gmaps\sat-tabriz-z14\maps',10295,6312,14,9,7,'D:\gmaps\sat-tabriz-z14\tabriz-z14.jpg')

This program is right but using matlab and running program based on RAM I cant merge more than 1000 images to gather.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.