Skip to main content
3 of 3
added 696 characters in body
kglr
  • 403.4k
  • 18
  • 501
  • 959

If jpg is not essential so that you can use png instead, setting the background to None in Export works:

Export["tst" <> ToString[#] <> ".png", Graphics[{EdgeForm[Thick], White, Rectangle[{0, 0}, {160, 90}], Flatten@({Flatten@(Table[ RandomChoice[{GrayLevel[.15], c0[[#]]}], {3}] & /@ Range[2, 4, 1]), MapThread[ Function[{Xs, Ys}, Rectangle[{Xs, Ys}, {Xs + 16, Ys + 9}]], {Flatten@ Table[Range[0, 32, 16], {3}], Flatten@(Table[#, {3}] & /@ Range[63, 81, 9])}]}\[Transpose]), Black, Thick, Line[{{0, 63}, {160, 63}}]}, ImageSize -> 300], Background -> None] & /@ Range[10] 

You get:

example png image

EDIT: To change the white rectangle to transparent, try

Export["xtst" <> ToString[#] <> ".png", Graphics[{EdgeForm[Thick], Opacity[0], Rectangle[{0, 0}, {160, 90}], Opacity[1], Flatten@({Flatten@(Table[ RandomChoice[{GrayLevel[.15], c0[[#]]}], {3}] & /@ Range[2, 4, 1]), MapThread[ Function[{Xs, Ys}, Rectangle[{Xs, Ys}, {Xs + 16, Ys + 9}]], {Flatten@ Table[Range[0, 32, 16], {3}], Flatten@(Table[#, {3}] & /@ Range[63, 81, 9])}]}\[Transpose]), Black, Thick, Line[{{0, 63}, {160, 63}}]}, ImageSize -> 300], Background -> None] & /@ Range[10] 

Picture against white and red background:

Transparent rectangle

kglr
  • 403.4k
  • 18
  • 501
  • 959