Giter VIP home page Giter VIP logo

Comments (5)

MercurySe7en avatar MercurySe7en commented on August 13, 2024 1

Works PERFECTLY now with the extra few lines of code!

I found your program specifically for this project, but I'm excited to use it for other projects in the future.

Thanks.

from stitch2d.

adamancer avatar adamancer commented on August 13, 2024

How strange. Can you please share your tiles so I can take a closer look?

from stitch2d.

MercurySe7en avatar MercurySe7en commented on August 13, 2024

It's quite a large file, so peeled off 4 rows near the top (see zip file). Issue still manifests the same.

Note that the problem row applies to the files starting with "0100_ * * .jpg" which is actually the 101st column since the first column is "0000" not "0001".

Thanks for looking at it. Smaller version of expected final result is picture below.

selection.zip

expected_output

from stitch2d.

adamancer avatar adamancer commented on August 13, 2024

I found the problem. When drawing a mosaic based purely on row/column (i.e., where there is no overlap between tiles and the user doesn't run the align method), the script expects all the tiles to have the same dimensions and places them by multiplying the column index by the tile width and row index by tile height. Since your last column is smaller than the rest, this results in a bad placement.

I'll fix this in the package, but in the meantime you can manually assign tile coordinates as follows:

from stitch2d import StructuredMosaic

mosaic = StructuredMosaic(
    "tiles",
    dim=4,                  
    origin="upper left",    
    direction="vertical",  
    pattern="raster"       
)

y = 0
for row in mosaic.grid:
    x = 0
    for tile in row:
        tile.x = x + tile.width
        tile.y = y + tile.height
        x += tile.width
    y += tile.height

mosaic.save("mosaic.jpg")

Note that this approach still expects all tiles in each column to have the same width and all tiles in each row to have the same height (so width/height can vary as long as each column/row is internally consistent).

Please let me know if that solves it for you.

from stitch2d.

adamancer avatar adamancer commented on August 13, 2024

Fixed in 09586c6

from stitch2d.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.