Repository: python-pillow/Pillow

Issue:
Bitmap ".eps" image have incorrect size and mode
* OS: OSX 11.6
* Python: 3.7.4
* Pillow: 9.1.1


```python
eps_file_path = "EPS_Bitmap.eps" # File was attached.
img = Image.open(eps_file_path)
print(img.mode, img.size)  # RGB (90, 60) --> correct: L, (500,333)
```
Am I doing it the wrong way? This is how I'm using it for now (getting data from %ImageData).Thank you.
```python
def get_eps_info(eps_file_path):
    """
    https://mail.python.org/pipermail/image-sig/2005-September/003575.html
    Photoshop 6.0 SDK
    EPS Parameters for ImageData (Photoshop 3.0 and later)
    columns      Width of the image in pixels
    rows         Height of the image in pixels
    depth        Number of bits per channel. Must be 1 or 8
    mode         Image mode. Bitmap/grayscale = 1; Lab = 2; RGB = 3; CMYK = 4
    pad channels Number of other channels stored in the file.
                Ignored when reading...
    block size   Number of bytes per row per channel.
                 Will be either 1 or formula (below):
                 1 = Data is interleaved
                 (columns*depth+7)/8 = Data is stored in line interleaved format
                 or there is only one channel
    binary/ascii 1 = Data is in binary format
                 2 = Data is in hex ascii format
    data start   Entire PostScriptline immediately preceding the image data.
                This entire line should not occur elewhere in the PostScript
                header code, but it may occur at part of line
    """
    p = re.compile(rb'%ImageData:\s(\d.+)\s"beginimage"')
    with open(eps_file_path, "rb") as f:
        for line in f.readlines():
            info = re.match(p, line)
            if info:
                columns, rows, depth, mode, pad_channels, block_size, data_format = map(
                    lambda x: int(x), info.group(1).decode().split(" "))
                return columns, rows, mode
print(get_eps_info(eps_file_path))  # (500, 333, 1)
```
[EPS_Bitmap.eps.zip](https://github.com/python-pillow/Pillow/files/8937742/EPS_Bitmap.eps.zip)




Discussion:
Interestingly, Pillow would match your expectations, except that the image has a [depth of 1](https://github.com/python-pillow/Pillow/blob/5fc3b6e5bbe6396246004b48e32afa1e19be231d/src/PIL/EpsImagePlugin.py#L291-L298). So then instead, it is using 'BoundingBox' instead of 'ImageData', and setting the image to RGB. This behaviour has been in place since PIL.
When Pillow is reading an EPS image, it is actually just passing the image through Ghostscript.

If I run `gs -q -g90x60 -r72.000000x72.000000 -dBATCH -dNOPAUSE -dSAFER -sDEVICE=ppmraw -sOutputFile=out.ppm -c 0 0 translate -f EPS_Bitmap.eps -c showpage`, then the resulting PPM image is RGB.

So I think the mode is correctly reflecting the way that Ghostscript renders the image.

As for the size, if you would like Pillow to switch to using the size from the ImageData, that seems like a reasonable request.
> ...sDEVICE=ppmraw -sOutputFile=out.ppm...

@radarhere I am sorry. I do not know ghostscript or PPM. And from wikipedia, ppm appears like a format with RGB color mode. Maybe this is right? (ppm-->pbm)
...sDEVICE=p**b**mraw -sOutputFile=out.p**b**m...
Thanks very much.
Wikipedia: [Netpbm](https://en.wikipedia.org/wiki/Netpbm#File_formats)
![pnm](https://user-images.githubusercontent.com/18019314/174695130-c8114f5c-750e-4102-bd9a-5d1ffd489171.png)

Additional, I find that transparency is always set to False. (Because EPS does not support transparency?).
https://github.com/python-pillow/Pillow/blob/5fc3b6e5bbe6396246004b48e32afa1e19be231d/src/PIL/EpsImagePlugin.py#L111
https://github.com/python-pillow/Pillow/blob/5fc3b6e5bbe6396246004b48e32afa1e19be231d/src/PIL/EpsImagePlugin.py#L330-L333


> Additional, I find that transparency is always set to False. (Because EPS does not support transparency?).

If you would like to load an EPS image with transparency, then you can use the following code.
```python
with Image.open("sample.eps") as im:
    im.load(transparency=True)
```
The documentation for this is at https://pillow.readthedocs.io/en/stable/releasenotes/8.4.0.html#added-transparency-argument-for-loading-eps-images and https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#eps
Is the image that you've provided one that could be included in our test suite, and distributed under our Pillow license? Or even better, are you able to provide a smaller image that demonstrates the same problem, also to be part of our test suite and distributed under our license?
Yes. Use this smaller one(46kb) please.
In Pillow 9.2.0 : 
```python
img.mode, img.size --> RGB (72, 48)
```
In Photoshop, the info is : Bitmap (100, 67)

[EPS_Bitmap.eps.zip](https://github.com/python-pillow/Pillow/files/9330305/EPS_Bitmap.eps.zip)



Resolving patch:
diff --git a/src/PIL/EpsImagePlugin.py b/src/PIL/EpsImagePlugin.py
--- a/src/PIL/EpsImagePlugin.py
+++ b/src/PIL/EpsImagePlugin.py
@@ -288,11 +288,14 @@ def _open(self):
                 # Encoded bitmapped image.
                 x, y, bi, mo = s[11:].split(None, 7)[:4]
 
-                if int(bi) != 8:
-                    break
-                try:
-                    self.mode = self.mode_map[int(mo)]
-                except ValueError:
+                if int(bi) == 1:
+                    self.mode = "1"
+                elif int(bi) == 8:
+                    try:
+                        self.mode = self.mode_map[int(mo)]
+                    except ValueError:
+                        break
+                else:
                     break
 
                 self._size = int(x), int(y)


Test patch:
diff --git a/Tests/images/1.eps b/Tests/images/1.eps
new file mode 100644
Binary files /dev/null and b/Tests/images/1.eps differ
diff --git a/Tests/test_file_eps.py b/Tests/test_file_eps.py
--- a/Tests/test_file_eps.py
+++ b/Tests/test_file_eps.py
@@ -146,6 +146,11 @@ def test_bytesio_object():
         assert_image_similar(img, image1_scale1_compare, 5)
 
 
+def test_1_mode():
+    with Image.open("Tests/images/1.eps") as im:
+        assert im.mode == "1"
+
+
 def test_image_mode_not_supported(tmp_path):
     im = hopper("RGBA")
     tmpfile = str(tmp_path / "temp.eps")