0
<pixel: u'Crop Marks', size=2478x3509, x=1, y=0, visible=1, mask=None, effects=[]>

I got an output from a psd parser in Python.

Which type of format is this?

Jerry
  • 1
  • Looks like a custom [`__repr__`](https://stackoverflow.com/questions/1984162/purpose-of-pythons-repr) implemented for that class. – metatoaster May 25 '18 at 05:31

1 Answers1

0

This is an instance of the psd_tools.user_api.layers.PixelLayer class of the psd_tools library. Everything in python is an instance of some type and therefore this. You can know it using the type(<object>) function.

Try dir(<object>) for seeing the list of attributes/ properties of that particular object. In your case, dir(p) where p = <pixel: u'Crop Marks', size=2478x3509, x=1, y=0, visible=1, mask=None, effects=[]> outputs,

['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_channels', '_clip_layers', '_effects', '_index', '_info', '_mask', '_parent', '_psd', '_record', '_tagged_blocks', 'as_PIL', 'as_pymaging', 'bbox', 'blend_mode', 'bottom', 'clip_layers', 'effects', 'flags', 'get_tag', 'has_box', 'has_clip_layers', 'has_effects', 'has_mask', 'has_pixels', 'has_relevant_pixels', 'has_tag', 'has_vector_mask', 'height', 'is_group', 'is_visible', 'kind', 'layer_id', 'left', 'mask', 'name', 'opacity', 'parent', 'right', 'tagged_blocks', 'top', 'vector_mask', 'visible', 'width']

It is a list of all the attributes, functions or the properties you can access from the psd instance. We can see that a custom __repr__ function has been defined for this which upon calling using p.__repr__() outputs the following format as a string "<pixel: u'Crop Marks', size=2478x3509, x=1, y=0, visible=1, mask=None, effects=[]>". Hope it answers your question.