code: def test_layers():
      out = BytesIO()
      test_card.save(
          out,
          "JPEG2000",
          quality_layers=[100, 50, 10],
          progression="LRCP",
      )
      out.seek(0)
  
      with Image.open(out) as im:
          im.layers = 1
          im.load()
          assert_image_similar(im, test_card, 13)
  
      out.seek(0)
      with Image.open(out) as im:
          im.layers = 3
          im.load()
          assert_image_similar(im, test_card, 0.4)
  
imports: import os
  import re
  from io import BytesIO
  import pytest
  from PIL import Image, ImageFile, Jpeg2KImagePlugin, UnidentifiedImageError, features
  from .helper import assert_image_equal, assert_image_similar, assert_image_similar_tofile, skip_unless_feature
label_desc: Use image node_id 22 for calling a global function with example usage: test_layers() without return types