png bottom image flipped
See original GitHub issuehello,
using the test files attached I got a perfect image from the up, but a wrong image in the bottom:
As you can see the silkscreen and the drill files should be inversed. Uploading the same files on OSHPark brings to correct images
This is my test file:
import os
from gerber import load_layer
from gerber.render import RenderSettings, theme
from gerber.render.cairo_backend import GerberCairoContext
GERBER_FOLDER = "C:\\Users\\vincenzo\\Desktop\\Gerber-test\\"
output = "C:\\Users\\vincenzo\\Desktop\\"
# The default style can be overridden by passing a RenderSettings instance to
# render_layer().
# First, create a settings object:
our_settings = RenderSettings(color=theme.COLORS['white'], alpha=0.85)
# Open the gerber files
drill = load_layer(os.path.join(GERBER_FOLDER, 'ATMEGA328.drl'))
copper = load_layer(os.path.join(GERBER_FOLDER, 'ATMEGA328-F_Cu.gbr'))
mask = load_layer(os.path.join(GERBER_FOLDER, 'ATMEGA328-F_Mask.gbr'))
silk = load_layer(os.path.join(GERBER_FOLDER, 'ATMEGA328-F_SilkS.gbr'))
# Create a new drawing context
ctx = GerberCairoContext()
# Draw the copper layer. render_layer() uses the default color scheme for the
# layer, based on the layer type. Copper layers are rendered as
ctx.render_layer(copper)
ctx.render_layer(mask)
ctx.render_layer(silk, settings=our_settings)
ctx.render_layer(drill)
# Write output to png file
ctx.dump(os.path.join(os.path.dirname(__file__), 'cairo_example.png'))
# Clear the drawing
ctx.clear()
# Load the bottom layers
copper = load_layer(os.path.join(GERBER_FOLDER, 'ATMEGA328-B_Cu.gbr'))
mask = load_layer(os.path.join(GERBER_FOLDER, 'ATMEGA328-B_Mask.gbr'))
silk = load_layer(os.path.join(GERBER_FOLDER, 'ATMEGA328-B_SilkS.gbr'))
# Render bottom layers
ctx.render_layer(copper)
ctx.render_layer(mask)
ctx.render_layer(silk, settings=our_settings)
ctx.render_layer(drill)
# Write png file
ctx.dump(os.path.join(os.path.dirname(__file__), 'cairo_bottom.png'))
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
A TGA image converted to PNG is flipped vertically. #3844
When converting a q3map2 -produced external lightmap file from TGA to PNG , the resulting image is vertically flipped.
Read more >Flip a PNG Vertically - Online PNG Maker
World's simplest online utility that flips PNG pictures vertically. Free, quick, and powerful. Import a PNG – flip it vertically.
Read more >Leaflet .png image-map with flipped coordinates?
i have a 4096x4096px .png that represents 15000x15000m. ... height: 1024px; border: 1px solid #ccc; margin-bottom: 10px; } </style> </head> ...
Read more >Flip Images: Free Online Image Flipper - Fotor
Simply open your images in Fotor app, then choose the flip icon at the bottom of your screen. Select either “Flip Horizontally” or...
Read more >Flip Images to Get a Perfect Shot - Photo Editor - Canva
1. Go to Canva and select any ready-made template. If you’re working on a custom project, click File then Create new design to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can also mirror the layer using RenderSettings:
If you want more control about the appearance of your pcb, RenderSettings is the way to go.
I recommend you to use
file.endswith(pattern)
to check for patterns instead offor ".." in file
.Hello, In the process of using it, I successfully render Gerber files on windows, but when porting to the Ubuntu system, all top layer inversion will appear when combined rendering, and there is no problem with single