         let data = try XCTUnwrap(encoder.encode(image))
 
         // Then
+        #if os(macOS)
+        // It seems that on macOS, NSImage created from png has an alpha
+        // component regardless of whether the input image has it.
+        XCTAssertEqual(ImageType(data), .png)
+        #else
         XCTAssertEqual(ImageType(data), .jpeg)
+        #endif
     }
 
     func testEncodeImagePNGTransparent() throws {

        XCTAssertEqual(ImageType(data), .jpeg)
    }

    func testEncodeImagePNGNonTransparent() throws {
        // Given
        let image = Test.image(named: "fixture", extension: "png")
        let encoder = ImageEncoders.Default()


    func testIsOpaqueWithOpaquePNG() {
        let image = Test.image(named: "fixture", extension: "png")
        #if os(macOS)
        XCTAssertFalse(image.cgImage!.isOpaque)
        #else
        XCTAssertTrue(image.cgImage!.isOpaque)
        #endif
    }

    func testIsOpaqueWithTransparentPNG() {
