吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 3493|回复: 48
收起左侧

[Python 原创] 微信朋友图九宫格代码,图案还有圆形。

[复制链接]
vocan 发表于 2024-10-16 01:25
可以拖动缩放,九宫格和圆形 QQ图片20241016012203.png QQ图片20241016012153.png `$S{3R]GCOL`UW6RX(9Y$]O.png
九宫格
[Python] 纯文本查看 复制代码
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QVBoxLayout, QHBoxLayout, QFileDialog, QMessageBox
from PyQt5.QtGui import QPixmap, QPainter, QPen, QImage
from PyQt5.QtCore import Qt, QPoint, QRect
from datetime import datetime
 
class ImageSplitter(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()
        self.image = None
        self.image_rect = None
        self.drag_start = None
        self.scale = 1.0
 
    def initUI(self):
        self.setWindowTitle('微信朋友圈九宫格图片分割工具by林林柒')
        self.setGeometry(100, 100, 650, 700)
         
        self.image_frame = QLabel(self)
        self.image_frame.setFixedSize(600, 600)
        self.image_frame.setAlignment(Qt.AlignCenter)
        self.image_frame.setStyleSheet("border: 1px solid black;")
         
        self.info_label = QLabel(self)
        self.info_label.setAlignment(Qt.AlignCenter)
         
        self.note_label = QLabel("备注:可以拖入图片或导入图片,可以拖动和鼠标滚轮缩放进行分割", self)
        self.note_label.setAlignment(Qt.AlignCenter)
         
        import_button = QPushButton('导入图片', self)
        import_button.clicked.connect(self.importImage)
         
        split_button = QPushButton('分割图片', self)
        split_button.clicked.connect(self.splitImage)
         
        button_layout = QHBoxLayout()
        button_layout.addWidget(import_button)
        button_layout.addWidget(split_button)
         
        layout = QVBoxLayout()
        layout.addWidget(self.image_frame)
        layout.addWidget(self.info_label)
        layout.addWidget(self.note_label)
        layout.addLayout(button_layout)
         
        self.setLayout(layout)
         
        self.setAcceptDrops(True)
 
    def importImage(self):
        file_name, _ = QFileDialog.getOpenFileName(self, "选择图片", "", "图片文件 (*.png *.jpg *.bmp)")
        if file_name:
            self.loadImage(file_name)
 
    def loadImage(self, file_name):
        self.image = QImage(file_name)
        if self.image.width() < 400 or self.image.height() < 400:
            self.info_label.setText("图片大小不能小于400*400")
            return
        self.scale = min(600 / self.image.width(), 600 / self.image.height())
        self.image_rect = QRect(0, 0, self.image.width() * self.scale, self.image.height() * self.scale)
        self.updateImage()
        self.info_label.setText(f"图片尺寸: {self.image.width()} x {self.image.height()}")
 
    def updateImage(self):
        if self.image:
            scaled_image = self.image.scaled(self.image_rect.width(), self.image_rect.height(),
                                             Qt.KeepAspectRatio, Qt.SmoothTransformation)
            pixmap = QPixmap(600, 600)
            pixmap.fill(Qt.white)
            painter = QPainter(pixmap)
            painter.drawImage(self.image_rect, scaled_image)
            self.drawGrid(painter)
            painter.end()
            self.image_frame.setPixmap(pixmap)
 
    def drawGrid(self, painter):
        pen = QPen(Qt.red, 2, Qt.SolidLine)
        painter.setPen(pen)
         
        w, h = 600, 600
        painter.drawLine(w/3, 0, w/3, h)
        painter.drawLine(2*w/3, 0, 2*w/3, h)
        painter.drawLine(0, h/3, w, h/3)
        painter.drawLine(0, 2*h/3, w, 2*h/3)
 
    def splitImage(self):
        if self.image:
            save_dir = QFileDialog.getExistingDirectory(self, "选择保存位置", "")
            if save_dir:
                frame_rect = self.image_frame.rect()
                visible_rect = self.image_rect.intersected(frame_rect)
                 
                # 计算可见区域在原图中的位置和大小
                orig_x = max(0, int((visible_rect.x() - self.image_rect.x()) / self.scale))
                orig_y = max(0, int((visible_rect.y() - self.image_rect.y()) / self.scale))
                orig_w = min(self.image.width() - orig_x, int(visible_rect.width() / self.scale))
                orig_h = min(self.image.height() - orig_y, int(visible_rect.height() / self.scale))
                 
                # 生成文件名前缀
                date_prefix = datetime.now().strftime("%Y%m%d%H%M%S")
                 
                for j in range(3):  # 先遍历行
                    for i in range(3):  # 再遍历列
                        x = orig_x + int(i * orig_w / 3)
                        y = orig_y + int(j * orig_h / 3)
                        w = int(orig_w / 3)
                        h = int(orig_h / 3)
                         
                        cropped = self.image.copy(x, y, w, h)
                        file_path = f'{save_dir}/{date_prefix}_{j*3+i+1:02d}.png'
                        cropped.save(file_path)
                 
                QMessageBox.information(self, "完成", f"图片已分割并保存到 {save_dir}")
            else:
                print("取消保存")
 
    def dragEnterEvent(self, event):
        if event.mimeData().hasUrls():
            event.accept()
        else:
            event.ignore()
 
    def dropEvent(self, event):
        files = [u.toLocalFile() for u in event.mimeData().urls()]
        if files:
            self.loadImage(files[0])
 
    def mousePressEvent(self, event):
        if self.image and self.image_frame.geometry().contains(event.pos()):
            self.drag_start = event.pos()
 
    def mouseMoveEvent(self, event):
        if self.drag_start and self.image:
            delta = event.pos() - self.drag_start
            self.image_rect.translate(delta)
            self.drag_start = event.pos()
            self.updateImage()
 
    def mouseReleaseEvent(self, event):
        self.drag_start = None
 
    def wheelEvent(self, event):
        if self.image:
            delta = event.angleDelta().y()
            if delta > 0:
                self.scale *= 1.1
            else:
                self.scale /= 1.1
            self.image_rect.setWidth(int(self.image.width() * self.scale))
            self.image_rect.setHeight(int(self.image.height() * self.scale))
            self.updateImage()
 
if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = ImageSplitter()
    ex.show()
    sys.exit(app.exec_())


圆形
[Python] 纯文本查看 复制代码
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QVBoxLayout, QHBoxLayout, QFileDialog, QMessageBox
from PyQt5.QtGui import QPixmap, QPainter, QPen, QImage, QColor, QBrush
from PyQt5.QtCore import Qt, QPoint, QRect
from datetime import datetime
 
class ImageSplitter(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()
        self.image = None
        self.image_rect = None
        self.drag_start = None
        self.scale = 1.0
 
    def initUI(self):
        self.setWindowTitle('微信朋友圈九宫格图片分割工具by林林柒')
        self.setGeometry(100, 100, 650, 700)
         
        self.image_frame = QLabel(self)
        self.image_frame.setFixedSize(600, 600)
        self.image_frame.setAlignment(Qt.AlignCenter)
        self.image_frame.setStyleSheet("border: 1px solid black;")
         
        self.info_label = QLabel(self)
        self.info_label.setAlignment(Qt.AlignCenter)
         
        self.note_label = QLabel("备注:可以拖入图片或导入图片,可以拖动和鼠标滚轮缩放进行分割", self)
        self.note_label.setAlignment(Qt.AlignCenter)
         
        import_button = QPushButton('导入图片', self)
        import_button.clicked.connect(self.importImage)
         
        split_button = QPushButton('分割图片', self)
        split_button.clicked.connect(self.splitImage)
         
        button_layout = QHBoxLayout()
        button_layout.addWidget(import_button)
        button_layout.addWidget(split_button)
         
        layout = QVBoxLayout()
        layout.addWidget(self.image_frame)
        layout.addWidget(self.info_label)
        layout.addWidget(self.note_label)
        layout.addLayout(button_layout)
         
        self.setLayout(layout)
         
        self.setAcceptDrops(True)
 
    def importImage(self):
        file_name, _ = QFileDialog.getOpenFileName(self, "选择图片", "", "图片文件 (*.png *.jpg *.bmp)")
        if file_name:
            self.loadImage(file_name)
 
    def loadImage(self, file_name):
        self.image = QImage(file_name)
        if self.image.width() < 400 or self.image.height() < 400:
            self.info_label.setText("图片大小不能小于400*400")
            return
        self.scale = min(600 / self.image.width(), 600 / self.image.height())
        self.image_rect = QRect(0, 0, self.image.width() * self.scale, self.image.height() * self.scale)
        self.updateImage()
        self.info_label.setText(f"图片尺寸: {self.image.width()} x {self.image.height()}")
 
    def updateImage(self):
        if self.image:
            scaled_image = self.image.scaled(self.image_rect.width(), self.image_rect.height(),
                                             Qt.KeepAspectRatio, Qt.SmoothTransformation)
            pixmap = QPixmap(600, 600)
            pixmap.fill(Qt.white)
            painter = QPainter(pixmap)
            painter.drawImage(self.image_rect, scaled_image)
            self.drawGrid(painter)
            painter.end()
            self.image_frame.setPixmap(pixmap)
 
    def drawGrid(self, painter):
        w, h = 600, 600
         
        # 绘制圆形
        pen = QPen(Qt.blue, 4, Qt.SolidLine)
        painter.setPen(pen)
        painter.setBrush(Qt.transparent)
        painter.drawEllipse(0, 0, w, h)
         
        # 绘制网格线
        pen = QPen(Qt.red, 2, Qt.SolidLine)
        painter.setPen(pen)
        painter.drawLine(w/3, 0, w/3, h)
        painter.drawLine(2*w/3, 0, 2*w/3, h)
        painter.drawLine(0, h/3, w, h/3)
        painter.drawLine(0, 2*h/3, w, 2*h/3)
         
        # 添加半透明遮罩
        mask = QImage(w, h, QImage.Format_ARGB32_Premultiplied)
        mask.fill(Qt.transparent)
        mask_painter = QPainter(mask)
        mask_painter.setBrush(QColor(255, 255, 255, 128))
        mask_painter.setPen(Qt.NoPen)
        mask_painter.drawRect(0, 0, w, h)
        mask_painter.setCompositionMode(QPainter.CompositionMode_DestinationOut)
        mask_painter.setBrush(Qt.black)
        mask_painter.drawEllipse(0, 0, w, h)
        mask_painter.end()
         
        painter.drawImage(0, 0, mask)
 
    def splitImage(self):
        if self.image:
            save_dir = QFileDialog.getExistingDirectory(self, "选择保存位置", "")
            if save_dir:
                frame_rect = self.image_frame.rect()
                visible_rect = self.image_rect.intersected(frame_rect)
                 
                # 计算可见区域在原图中的位置和大小
                orig_x = max(0, int((visible_rect.x() - self.image_rect.x()) / self.scale))
                orig_y = max(0, int((visible_rect.y() - self.image_rect.y()) / self.scale))
                orig_w = min(self.image.width() - orig_x, int(visible_rect.width() / self.scale))
                orig_h = min(self.image.height() - orig_y, int(visible_rect.height() / self.scale))
                 
                # 生成文件名前缀
                date_prefix = datetime.now().strftime("%Y%m%d%H%M%S")
                 
                # 创建圆形遮罩
                mask = QImage(orig_w, orig_h, QImage.Format_ARGB32_Premultiplied)
                mask.fill(Qt.transparent)
                mask_painter = QPainter(mask)
                mask_painter.setBrush(Qt.white)
                mask_painter.setPen(Qt.NoPen)
                mask_painter.drawEllipse(0, 0, orig_w, orig_h)
                mask_painter.end()
                 
                # 应用遮罩到整个图像,并用白色填充透明部分
                result = QImage(orig_w, orig_h, QImage.Format_RGB32)
                result.fill(Qt.white)
                result_painter = QPainter(result)
                result_painter.setCompositionMode(QPainter.CompositionMode_SourceOver)
                result_painter.drawImage(0, 0, self.image.copy(orig_x, orig_y, orig_w, orig_h))
                result_painter.setCompositionMode(QPainter.CompositionMode_DestinationIn)
                result_painter.drawImage(0, 0, mask)
                result_painter.setCompositionMode(QPainter.CompositionMode_DestinationOver)
                result_painter.fillRect(result.rect(), Qt.white)
                result_painter.end()
                 
                # 分割圆形图像
                for j in range(3):
                    for i in range(3):
                        x = int(i * orig_w / 3)
                        y = int(j * orig_h / 3)
                        w = int(orig_w / 3)
                        h = int(orig_h / 3)
                         
                        cropped = result.copy(x, y, w, h)
                        file_path = f'{save_dir}/{date_prefix}_{j*3+i+1:02d}.jpg'
                        cropped.save(file_path, 'JPEG', 100)
                 
                QMessageBox.information(self, "完成", f"圆形图片已分割并保存到 {save_dir}")
            else:
                print("取消保存")
 
    def dragEnterEvent(self, event):
        if event.mimeData().hasUrls():
            event.accept()
        else:
            event.ignore()
 
    def dropEvent(self, event):
        files = [u.toLocalFile() for u in event.mimeData().urls()]
        if files:
            self.loadImage(files[0])
 
    def mousePressEvent(self, event):
        if self.image and self.image_frame.geometry().contains(event.pos()):
            self.drag_start = event.pos()
 
    def mouseMoveEvent(self, event):
        if self.drag_start and self.image:
            delta = event.pos() - self.drag_start
            self.image_rect.translate(delta)
            self.drag_start = event.pos()
            self.updateImage()
 
    def mouseReleaseEvent(self, event):
        self.drag_start = None
 
    def wheelEvent(self, event):
        if self.image:
            delta = event.angleDelta().y()
            if delta > 0:
                self.scale *= 1.1
            else:
                self.scale /= 1.1
            self.image_rect.setWidth(int(self.image.width() * self.scale))
            self.image_rect.setHeight(int(self.image.height() * self.scale))
            self.updateImage()
 
if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = ImageSplitter()
    ex.show()
    sys.exit(app.exec_())

免费评分

参与人数 7吾爱币 +12 热心值 +5 收起 理由
qwq5555 + 1 + 1 太酷啦!
苏紫方璇 + 7 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
feiyu361 + 1 + 1 用心讨论,共获提升!
thao01 + 1 谢谢@Thanks!
hackyun + 1 热心回复!
kexing + 1 + 1 成品+1 在21楼
康哥 + 1 成品发到19楼了,不客气

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

康哥 发表于 2024-10-16 09:00
本帖最后由 康哥 于 2024-10-16 21:47 编辑

直接运行会报错
报错内容是
[Asm] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
10
11
12
13
PS H:\py> python .\9.py     
Traceback (most recent call last):
  File "H:\py\9.py", line 54, in importImage
    self.loadImage(file_name)
  File "H:\py\9.py", line 62, in loadImage
    self.image_rect = QRect(0, 0, self.image.width() * self.scale, self.image.height() * self.scale)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: arguments did not match any overloaded call:
  QRect(): too many arguments
  QRect(aleft: int, atop: int, awidth: int, aheight: int): argument 3 has unexpected type 'float'
  QRect(atopLeft: QPoint, abottomRight: QPoint): argument 1 has unexpected type 'int'
  QRect(atopLeft: QPoint, asize: QSize): argument 1 has unexpected type 'int'
  QRect(a0: QRect): argument 1 has unexpected type 'int'

把代码给ai修了一下,报错解决了
成品打包:
https://kang.lanzouo.com/i7b4V2cnivhe

*

http://cdn.kggzs.cn/BlackMythWukong/9.exe
[Python] 纯文本查看 复制代码
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import sysfrom PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QVBoxLayout, QHBoxLayout, QFileDialog, QMessageBox
from PyQt5.QtGui import QPixmap, QPainter, QPen, QImage
from PyQt5.QtCore import Qt, QPoint, QRect
from datetime import datetime
 
class ImageSplitter(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()
        self.image = None
        self.image_rect = None
        self.drag_start = None
        self.scale = 1.0
 
    def initUI(self):
        self.setWindowTitle('微信朋友圈九宫格图片分割工具by林林柒')
        self.setGeometry(100, 100, 650, 700)
          
        self.image_frame = QLabel(self)
        self.image_frame.setFixedSize(600, 600)
        self.image_frame.setAlignment(Qt.AlignCenter)
        self.image_frame.setStyleSheet("border: 1px solid black;")
          
        self.info_label = QLabel(self)
        self.info_label.setAlignment(Qt.AlignCenter)
          
        self.note_label = QLabel("备注:可以拖入图片或导入图片,可以拖动和鼠标滚轮缩放进行分割", self)
        self.note_label.setAlignment(Qt.AlignCenter)
          
        import_button = QPushButton('导入图片', self)
        import_button.clicked.connect(self.importImage)
          
        split_button = QPushButton('分割图片', self)
        split_button.clicked.connect(self.splitImage)
          
        button_layout = QHBoxLayout()
        button_layout.addWidget(import_button)
        button_layout.addWidget(split_button)
          
        layout = QVBoxLayout()
        layout.addWidget(self.image_frame)
        layout.addWidget(self.info_label)
        layout.addWidget(self.note_label)
        layout.addLayout(button_layout)
          
        self.setLayout(layout)
          
        self.setAcceptDrops(True)
 
    def importImage(self):
        file_name, _ = QFileDialog.getOpenFileName(self, "选择图片", "", "图片文件 (*.png *.jpg *.bmp)")
        if file_name:
            self.loadImage(file_name)
 
    def loadImage(self, file_name):
        self.image = QImage(file_name)
        if self.image.width() < 400 or self.image.height() < 400:
            self.info_label.setText("图片大小不能小于400*400")
            return
        self.scale = min(600 / self.image.width(), 600 / self.image.height())
        self.image_rect = QRect(0, 0, int(self.image.width() * self.scale), int(self.image.height() * self.scale))
        self.updateImage()
        self.info_label.setText(f"图片尺寸: {self.image.width()} x {self.image.height()}")
 
    def updateImage(self):
        if self.image:
            scaled_image = self.image.scaled(self.image_rect.width(), self.image_rect.height(),
                                             Qt.KeepAspectRatio, Qt.SmoothTransformation)
            pixmap = QPixmap(600, 600)
            pixmap.fill(Qt.white)
            painter = QPainter(pixmap)
            painter.drawImage(self.image_rect, scaled_image)
            self.drawGrid(painter)
            painter.end()
            self.image_frame.setPixmap(pixmap)
 
    def drawGrid(self, painter):
        pen = QPen(Qt.red, 2, Qt.SolidLine)
        painter.setPen(pen)
          
        w, h = 600, 600
        painter.drawLine(w // 3, 0, w // 3, h)
        painter.drawLine(2 * w // 3, 0, 2 * w // 3, h)
        painter.drawLine(0, h // 3, w, h // 3)
        painter.drawLine(0, 2 * h // 3, w, 2 * h // 3)
 
    def splitImage(self):
        if self.image:
            save_dir = QFileDialog.getExistingDirectory(self, "选择保存位置", "")
            if save_dir:
                frame_rect = self.image_frame.rect()
                visible_rect = self.image_rect.intersected(frame_rect)
                  
                # 计算可见区域在原图中的位置和大小
                orig_x = max(0, int((visible_rect.x() - self.image_rect.x()) / self.scale))
                orig_y = max(0, int((visible_rect.y() - self.image_rect.y()) / self.scale))
                orig_w = min(self.image.width() - orig_x, int(visible_rect.width() / self.scale))
                orig_h = min(self.image.height() - orig_y, int(visible_rect.height() / self.scale))
                  
                # 生成文件名前缀
                date_prefix = datetime.now().strftime("%Y%m%d%H%M%S")
                  
                for j in range(3):  # 先遍历行
                    for i in range(3):  # 再遍历列
                        x = orig_x + int(i * orig_w / 3)
                        y = orig_y + int(j * orig_h / 3)
                        w = int(orig_w / 3)
                        h = int(orig_h / 3)
                          
                        cropped = self.image.copy(x, y, w, h)
                        file_path = f'{save_dir}/{date_prefix}_{j*3+i+1:02d}.png'
                        cropped.save(file_path)
                  
                QMessageBox.information(self, "完成", f"图片已分割并保存到 {save_dir}")
            else:
                print("取消保存")
 
    def dragEnterEvent(self, event):
        if event.mimeData().hasUrls():
            event.accept()
        else:
            event.ignore()
 
    def dropEvent(self, event):
        files = [u.toLocalFile() for u in event.mimeData().urls()]
        if files:
            self.loadImage(files[0])
 
    def mousePressEvent(self, event):
        if self.image and self.image_frame.geometry().contains(event.pos()):
            self.drag_start = event.pos()
 
    def mouseMoveEvent(self, event):
        if self.drag_start and self.image:
            delta = event.pos() - self.drag_start
            self.image_rect.translate(delta)
            self.drag_start = event.pos()
            self.updateImage()
 
    def mouseReleaseEvent(self, event):
        self.drag_start = None
 
    def wheelEvent(self, event):
        if self.image:
            delta = event.angleDelta().y()
            if delta > 0:
                self.scale *= 1.1
            else:
                self.scale /= 1.1
            self.image_rect.setWidth(int(self.image.width() * self.scale))
            self.image_rect.setHeight(int(self.image.height() * self.scale))
            self.updateImage()
 
if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = ImageSplitter()
    ex.show()
    sys.exit(app.exec_())

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
zhendebuyiban + 1 + 1 2015年注册的大佬!

查看全部评分

kexing 发表于 2024-10-16 09:16
本帖最后由 kexing 于 2024-10-16 21:40 编辑
Liyang001013 发表于 2024-10-16 08:05
有成品吗?不会用

感谢分享 已收藏 打包成品分享到阿里云
https://www.alipan.com/s/jDiQ5xnsim5

免费评分

参与人数 3吾爱币 +3 热心值 +3 收起 理由
popofeng + 1 + 1 谢谢@Thanks!
yanglinman + 1 谢谢@Thanks!
35925 + 2 + 1 感谢铁子的分享

查看全部评分

Liyang001013 发表于 2024-10-16 08:05
1045837055lucy 发表于 2024-10-16 10:23
康哥 发表于 2024-10-16 09:00
直接运行会报错
报错内容是[mw_shl_code=asm,true]PS H:\py> python .\9.py      
Traceback (most recen ...

直点两个链接连在一起出错,显示“https://kang.lanzouo.com/i7b4V2c ... ackMythWukong/9.exe”,分隔下可以下载。
地址一:https://kang.lanzouo.com/i7b4V2cnivhe

地址二:http://cdn.kggzs.cn/BlackMythWukong/9.exe

免费评分

参与人数 1热心值 +1 收起 理由
Aooxe + 1 我很赞同!

查看全部评分

vbpuro 发表于 2024-10-16 07:43
感谢分享。
35925 发表于 2024-10-16 07:44
我在py调试器里运行提示:
C:\Users\Administrator\AppData\Local\Programs\Python\Python312\python.exe C:\Users\Administrator\Desktop\圆形.py
Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\圆形.py", line 2, in <module>
    from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QVBoxLayout, QHBoxLayout, QFileDialog, \
ModuleNotFoundError: No module named 'PyQt5'

进程已结束,退出代码为 1
Wapj_Wolf 发表于 2024-10-16 08:03
原来分割图片还能这么玩,学习了。
d199212 发表于 2024-10-16 08:05
原来是一张图切出来的,每次看到九宫格都会想怎么有这么凑巧的图片
Abear 发表于 2024-10-16 08:19
学习了,超级赞
dx163 发表于 2024-10-16 08:20
需要一个成品最好啊
学士天下 发表于 2024-10-16 08:22
新手就是很难,让我再学一下
风华绝代谢长留 发表于 2024-10-16 08:26
这个有点意思,赞一个
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-5-21 06:39

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表