Home Forums Nazca AttributeError: module ‘nazca’ has no attribute ‘image’

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #5351
    Pervaiz
    Member

    Hi,

    I am having an issue when I try to convert some image into GDS. I am following the example code provided in the tutorial section (https://nazca-design.org/convert-image-to-gds/). It seems that nazca.image doesn’t exist anymore. I also checked util.image, unfortunately, the result is the same error. Can someone please guide me that how to convert an image to GDS using nazca 0.9.1 ?

    Thanks!

    #5353
    Ronald
    Keymaster

    Dear Pervaiz,

    Note that Nazca Design is at version 0.4.3. Hence, the version number you mention (0.9.1) is very helpful in identifying that you have another unrelated nazca package alltogether.

    If you follow the installation on https://nazca-design.org/installation/ you should be fine.

    Ronald

    #5354
    Pervaiz
    Member

    Hi Ronald,

    Thanks a lot. Yes, that was the issue. I think it would be better if it is mentioned somewhere on the homepage that directly using “pip install nazca” will actually install some different package.

    Thanks again.

    #6752
    bhchoi98
    Participant

    Hi, I’m suffering the same problem with Pervaiz.

    I manually installed the latest version of the nazca (0.5.13), but following error occurs:

    AttributeError: module ‘nazca’ has no attribute ‘image’

    Which version should I use? The latest version does not support image attribute anymore?

     

    • This reply was modified 2 years, 5 months ago by bhchoi98.
    #6754
    Ronald
    Keymaster

    Dear bhchoi98,

    I think this was solved in the answer to Pervaiz:

    If you follow the installation on https://nazca-design.org/installation/ you should be fine.

    “pip install nazca” is an unrelated package to Nazca Design.

    Ronald

    #6756
    bhchoi98
    Participant

    Hi Ronald,

    Thanks for the reply. I installed nazca again as installation guide, and now it works fine.

    Actually i have one more question about ‘image’ attribute of nazca package.

    As the following tutorial: https://nazca-design.org/convert-image-to-gds/, I tried to invert the image as below.

    nd.image(‘image.jpg’, invert=True).put(1000)

    nd.export_gds()

    But the output’s size was not the same as the input (e.g. 1000 by 1000 png file-> 1000 mircombeter by 800 micrometer).

    Do you know how to solve this problem?

    Thank you.

    • This reply was modified 2 years, 5 months ago by bhchoi98.
    • This reply was modified 2 years, 5 months ago by bhchoi98.
    • This reply was modified 2 years, 5 months ago by bhchoi98.
    #6763
    Xaveer
    Moderator

    Dear bhchoi98,

    It should work as advertised. The default pixel size is one micron and the default image size is 256 pixels. You can change both. Keeping the default pixel size, this code produces both the normal and the inverted picture. Note that put(1000) will put the center of the image at (1000, 0) microns in the GDS file and that the size argument changes the resolution of the picture in the GDS file (it’s size in pixels).

    import nazca as nd
    nd.image(‘testimg.png’, size=1000, invert=True, layer=1).put(1000)
    nd.image(‘testimg.png’, size=1000, invert=False, layer=2).put(1000)
    nd.export_gds()

    See the documentation at https://nazca-design.org/manual/nazca.html?highlight=image#nazca.bb_util.image

    Hope that works.

    Xaveer

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.