winnerlop.blogg.se

Convert image to psd with layers
Convert image to psd with layers






convert image to psd with layers

Output = nested_layers.nested_layers_to_psd(layers, color_mode=3) #you can save layers returned from this into just a regular list and then at the end (after doing whatever) #if you wanted to add the layer to be under the albedo_group in the psd We also have the albedo_group so we can add layers easier later #make albedo group if it doesn't exist alreadyĪlbedo_group = nested_layers.Group(name="albedo", visible=True, opacity=255, group_id=0, NewLayer = pillow_image_to_pyto_image(imageName, pillowImage, xPos, yPos, True, 255, 0,, None, 0, None, width = (optional but if filled in will resize image), height = (optional but if filled in will resize image)) #overall layers list for later psd saving

convert image to psd with layers

#albedo_group for making psd grouping later NewLayer = nested_layers.Image(name=name, visible=visible, opacity=opacity, group_id=group_id, blend_mode=blend_mode, top=y, left=x, channels=channels, metadata=metadata, layer_color=layer_color, color_mode=color_mode) Else we get one single colour which isn't rightĬhannels =, arr, arr]Ĭhannels =, arr, arr, arr] #we just copy the same channel 3 times as it's black and white. Image = image.resize((width, height), Image.LANCZOS) If ((width != 0 and width != image.width) or (height != 0 and height != image.height )): '''ease of use method for converting an image loaded via PIL to be made layer ready for Pytoshop''' #Convert Pillow image to pyto layer (not fool proof by anymeans)ĭef pillow_image_to_pyto_image(name, image, x, y, visible, opacity, group_id, blend_mode, metadata, layer_color, color_mode, width = 0, height = 0): From pytoshop.image_data import ImageData








Convert image to psd with layers