Resize image by filling with source ?

Discussion in 'Computer Software and Operating Systems' started by pasc, Feb 17, 2013.

Feb 17, 2013
  1. pasc
    OP

    Member pasc GBATemps official GBA Freak

    Joined:
    Sep 9, 2006
    Messages:
    2,570
    Location:
    Germany
    Country:
    Germany
    Well, despite this random threadtitle, my question is actually quite reasonable.

    I want to resize this picture:
    [​IMG]

    to look like this:
    Warning: Spoilers inside!

    Requirements:
    ------------------
    - Be able to adjust the size of the new higher res picture (e.g. give a width x height count)
    - Batch conversion potiential: convert multiple pictures in this fashion ( I have a few hundred to do).


    I know it is possible to get this effect done using Adobe Photoshops "Pattern/Fill" function.
    Paint.NET also has a similar function.

    However I would need to do this in batch. Its a simple "fill new picture of size X*Y with the old one instead of plainly resizing it.

    Thanks in advance for suggestions.

    MODS: Feel free to move this in an appropriate forum, I couldn't find a better one - sorry.
     


  2. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,698
    Country:
    United Kingdom
    I do not have a working suggestion at this moment but my "forest for the trees" line of thought says might it not be better to make a huge tile image (100000x200000 or whatever) and crop that into a new image however many times it needs doing?
     
  3. pasc
    OP

    Member pasc GBATemps official GBA Freak

    Joined:
    Sep 9, 2006
    Messages:
    2,570
    Location:
    Germany
    Country:
    Germany
    it would be utterly annoying to do this for 500+ files...

    Each file I want to resize has different content.
    The one you are seeing up there is just a 001 from maaaany ones.

    I understand however that my request is very specific and there may be no easy/batch approach to it.
     
  4. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,698
    Country:
    United Kingdom
    Yeah I saw the different files requirement. I am now free to ponder some more stuff and this looks like it is going to take some http://www.imagemagick.org/script/montage.php and http://www.imagemagick.org/script/convert.php action rather than my usual go to options of gimp and irfanview.

    I am still opting for the montage (tile is easy enough to pull off here) and crop down option rather than trying to create a tiled background layer and flattening it or something.

    "montage.exe -geometry +0+0 filename.file filename.file filename.file filename.file filename.file filename.file output.file"
    That should generate the tile effect and call it output.file (repeat filename.file however many times is necessary to create a proper tiled thing- 2x2 =4 ,3x3=9 .....).

    Crop from here. You can go back to a proper crop but if you are going custom a batch file might work well.
    "convert nicebigtiledfile.file -crop 640x480 outputfile.jpg"
    Tweaks should be fairly obvious and it should spit out cropped files.

    On a different note it looks like I am going to have to go back and learn imagemagick as I fear I am going to have a use for this as this year drags on.
     
  5. pasc
    OP

    Member pasc GBATemps official GBA Freak

    Joined:
    Sep 9, 2006
    Messages:
    2,570
    Location:
    Germany
    Country:
    Germany
    Since I don't feel like opening a new thread I'm gonna ask here.

    This is a similar problem than before with just a little twist added:

    I would like to do the following using image magick:

    1. set a specific canvas size, say 1056x576 for example
    2. Take one image, this one for example.
    3. Have image magick stitch this image multiple times over said canvas so it will look like this.
     
  6. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,698
    Country:
    United Kingdom
    Assuming the image is built to be tiled I do not see the twist/how it is different (or at least how the solution above falls short) as you can tile it again and crop it like before.
     
  7. pasc
    OP

    Member pasc GBATemps official GBA Freak

    Joined:
    Sep 9, 2006
    Messages:
    2,570
    Location:
    Germany
    Country:
    Germany
    as you can see in the image the result has the images overlapping on several parts...

    I'd like to do it without cropping. Having ImageMagick automatically stitch the images together.
     
  8. Plainscript

    Member Plainscript GBAtemp Regular

    Joined:
    Nov 18, 2012
    Messages:
    110
    Country:
    Netherlands
    Not sure if this is even possible..

    If you're willing to crop (well, the next time):

    Took this as a source, modifying yours [​IMG]

    The following script:

    Code:
    infile="castillo.gif"
     
    h2=`convert $infile -format "%[fx:round(h/2)]" info:`
     
    convert $infile \( -clone 0 -roll +0+$h2 \) +append -write mpr:sometile +delete -size 1056x576 tile:mpr:sometile output.png
    
    This is the result: LINK FOR SANITY.
     
  9. pasc
    OP

    Member pasc GBATemps official GBA Freak

    Joined:
    Sep 9, 2006
    Messages:
    2,570
    Location:
    Germany
    Country:
    Germany
    hmm...

    this is the result I desire:

    Warning: Spoilers inside!

    This is what your attempt gave out:

    Warning: Spoilers inside!

    Looks kinda different to me...

    Well I guess ImageMagick isn't for me then.

    This one here looked promising aswell...
     
  10. Plainscript

    Member Plainscript GBAtemp Regular

    Joined:
    Nov 18, 2012
    Messages:
    110
    Country:
    Netherlands
    Had to crop your sourcefile. It's possible to get it that way. Just fiddle around with it. :)
     
  11. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,698
    Country:
    United Kingdom
    Ah yes I see that now.... unless you have numbers you can feed it to align the tiles (in which case I imagine you would have just cropped the images and gone normally) I am not sure where to look. I do not doubt there is automated software out there* that can try to do it for you but it is not something I have really had to consider- if it is one or two images I will crop them myself, if I am making the image/having it made I would make sure to have it done it properly and if I was given a large batch of them I would say no thanks.

    *you might do better to find some of the stuff you can manually guide into position as visual pattern recognition is not a computer strongpoint.
     
  12. pasc
    OP

    Member pasc GBATemps official GBA Freak

    Joined:
    Sep 9, 2006
    Messages:
    2,570
    Location:
    Germany
    Country:
    Germany
    well... FAST6191 I don't know if it is the same, however the one map stitching software I recently tried worked perfect with a moving video, however the task I desire is probably too complicated (and takes WAY to long to do by hand).

    I was so sure it should be possilbe to align images along a given canas just by matching fitting points in each image...
     
  13. Plainscript

    Member Plainscript GBAtemp Regular

    Joined:
    Nov 18, 2012
    Messages:
    110
    Country:
    Netherlands
    I'm willing to fiddle around with this concept.. I think it's pretty interesting actually.

    Gimme a few days..
     
  14. pasc
    OP

    Member pasc GBATemps official GBA Freak

    Joined:
    Sep 9, 2006
    Messages:
    2,570
    Location:
    Germany
    Country:
    Germany
    Nice :) Thanks alot.
     
  15. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,698
    Country:
    United Kingdom
    You have video software that can do that*? If you really want it is not hard to present a video program with a static image or three all while thinking it is a video and have it do it if you prefer; basic tools like avisynth will do that. I can see it working slightly better though as modern video encoding is all about the motion displacement and high end masking filters are great fans of reference points.

    *is it for dual camera 3d by any chance?

    "just by matching fitting points" [by hand?]
    Functionally that is no different to providing the cropping information or otherwise overlapping it properly. This is what Plainscript appears to have attempted to do for you (using a far nicer functional/using variables approach than my "copy and paste enough times to wing it" approach from earlier).
    If they are all kind of like of that (simple emblems on a static or different enough background*) then you might be able to build it back up but say cropping to the edge of the emblem (automated cropping is far more feasible), figuring out how much space you need between the emblems, what the background should be and then building that up. On your image though I do not know if the "stained glass" effect is a GIF lossy image error or something you are actually seeking.

    *we are heading into actual fun territory now but you could probably cook up a method to mask the emblem thing out similar to how you might make a layer mask using brightness/contrast techniques.

    Beyond that I got curious though so I went looking, sadly the terms as they apply to graphics focus more on 3d these days (the act of putting shapes together is known as tessellation - adaptive, automated, texture being what I thought would be good ideas to stick on them) though that has given me some interesting reading material (it seems I need to read up on Displacement Mapping) or proper old school maths/computer science (see Wang tiles). I am quite prepared to have been using the wrong search terms though (undercropped did not get me anywhere).
     
  16. KazoWAR

    Member KazoWAR GBAtemp Advanced Maniac

    Joined:
    Aug 12, 2008
    Messages:
    1,747
    Location:
    Winter Haven
    Country:
    United States
    pasc likes this.
  17. pasc
    OP

    Member pasc GBATemps official GBA Freak

    Joined:
    Sep 9, 2006
    Messages:
    2,570
    Location:
    Germany
    Country:
    Germany
    Seriously. gotta love this place here :)

    However it seems that the approach you used is simlar to the one I asked for at the ImageMagick Forums:

    http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=22860&start=15
    That script there has the same problem as yours has.
    It is unable to puzzle toghether specific images. (See the link I posted)

    BTW: I also asked that at the other forum: How is it possible to repeat a batch script over all files in a folder and have the output named 001, 002 ... ?
    Can't seem to find a satisfying answer...

    Things start to get interesting, we are getting somewhere :)

    FAST6191: I'm not sure what you meant by dual camera... the Software I have is capable of taking a video you made (be it a side-by-side moving or random direction moving video) and stitch together any map that is seen on the video itself.
     
  18. KazoWAR

    Member KazoWAR GBAtemp Advanced Maniac

    Joined:
    Aug 12, 2008
    Messages:
    1,747
    Location:
    Winter Haven
    Country:
    United States
    hmm i think i understand what you want. but it might be impossible. I think your asking that you don't just want images tiled, but you want the images reconfigure so that the tiled image has a seamless connection with all 4 sides.
     
  19. pasc
    OP

    Member pasc GBATemps official GBA Freak

    Joined:
    Sep 9, 2006
    Messages:
    2,570
    Location:
    Germany
    Country:
    Germany
  20. pasc
    OP

    Member pasc GBATemps official GBA Freak

    Joined:
    Sep 9, 2006
    Messages:
    2,570
    Location:
    Germany
    Country:
    Germany
    Ok KazoWAR :)

    I think I found the perfect solution to make your tool PERFECT !

    Do you think it would be possible to add the following to your tool ?:

    An option that allows the user to enter a width and height size.
    This size shall than be the value that the images will be cropped before your tool processes them.

    Thanks in advance.

    I'm sure after this is added this tool will work with every single picture that sports recurring patterns.
    The only thing one has to do then is to find the crop area.
     

Share This Page