What I would like to do is create an image (2048x2048 in my case) The algorithm should work in this way:
-User select some images开发者_高级运维 from a folder and tells my program "generate image"
-The program check if can put all images inside a single image (size problem), otherwise returns an error message
-The program find the correct way to put all images inside the image and then prompt the user to choose a savepath (obviusly old images shouldn't be resized/cut)
The problem is obviusly the last step, I don't have actually idea how to do it, also there is another thing the program should check, if an image filename is myimage_1 and there is a "myimage_2" those images should be put near eachother (obiusly same for 3,4 and so on)
Can someone help me with this?
it looks like a multi-dimensional knapsack problem to me. More info here. There may be of course simple solutions as I'm no expert on the domain and my algorithms classes are far behind me! It will perhaps help anyway to launch the thread :)
You could perhaps also solve this by adapting an easy greedy algorithm but it will of course not give the optimal solution and will then surely lead to some false negatives for your 2nd step.
精彩评论